jsHarmony
raw JSON → 1.40.14 verified Sat Apr 25 auth: no javascript
jsHarmony is a Rapid Application Development (RAD) platform for Node.js, focused on database application development. It provides an integrated framework for building server-side applications with automatic model generation, built-in authentication, and support for PostgreSQL and MSSQL via separate driver packages. Current stable version is 1.40.14. Release cadence appears irregular. Key differentiators include a model-driven approach with automatic schema generation and a focus on database-first development compared to more general-purpose Node.js frameworks like Express.
Common errors
error Error: Cannot find module 'jsharmony-db-pgsql' ↓
cause PostgreSQL driver not installed or missing from package.json.
fix
Run: npm install jsharmony-db-pgsql --save
error TypeError: jsh.DBConfig['default'] is undefined ↓
cause Database configuration not set before calling jsh.Run().
fix
Assign to jsh.DBConfig['default'] before jsh.Run(), e.g., jsh.DBConfig['default'] = { ... }
error Error: ENOENT: no such file or directory, open '.../data/...' ↓
cause Missing 'data' folder in application root.
fix
Create a 'data' directory in the project root or set jsh.Config.appbasepath to a valid path.
Warnings
breaking The 'data' folder must exist in the application root or be configured via jsh.Config.appbasepath. ↓
fix Create a 'data' folder in the project root or set jsh.Config.appbasepath to an existing directory before calling jsh.Run().
gotcha Static authentication must be configured in the Init callback, not before. ↓
fix Wrap authentication setup inside jsh.Init(function(){ ... jsh.Run(); });
deprecated The default HTTP port is set via jsh.Config.server.http_port; HTTPS is optional and requires certificate files. ↓
fix Set jsh.Config.server.https_port to 0 to disable HTTPS, or provide valid certificate paths.
Install
npm install jsharmony yarn add jsharmony pnpm add jsharmony Imports
- jsHarmony (default) wrong
import jsHarmony from 'jsharmony';correctconst jsHarmony = require('jsharmony'); - jsHarmony.Auth.Static wrong
const { Auth } = require('jsharmony');correctjsHarmony.Auth.Static([...]); - jsHarmony (TypeScript) wrong
import * as jsHarmony from 'jsharmony';correctimport jsHarmony = require('jsharmony');
Quickstart
const jsHarmony = require('jsharmony');
const pgsqlDBDriver = require('jsharmony-db-pgsql');
const jsh = new jsHarmony();
jsh.DBConfig['default'] = {
host: 'server.domain.com',
database: 'DBNAME',
user: 'DBUSER',
password: 'DBPASS',
_driver: new pgsqlDBDriver()
};
jsh.Config.server = {
http_port: 3000,
https_port: 0
};
jsh.Run();