Simple ORM (Object-Relational Mapping) library for Node.js that connects to PostgreSQL databases. Version 2.2.5, actively maintained. Key features include an intuitive CRUD interface, automatic field/public field management, custom SQL expressions, support for database triggers, and alias-based joins for related entities. The ORM uses a configuration-driven approach where you define models with fields, default values, public visibility, computed fields, and hooks (before/after select, insert, update, delete). It supports custom validation, hashing, and auto-initialization with init functions. Compared to heavier ORMs like Sequelize or TypeORM, jorm is lightweight and focuses on simplicity and flexibility without sacrificing control over SQL.
npm install jormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures jorm with a PostgreSQL connection, defines a User model with fields, creates and saves a new user, and outputs the public fields.
Wrap calls in a promise: const save = util.promisify(user.save.bind(user)); await save();
Use init to set computed or transformed values (e.g., hash password). Do not perform async operations inside init.
To include a field in all getPublic() calls, set {public: true}. To include only in specific scopes, use {public: 'scopeName'}.Pass {demand: ['fieldName']} in the query parameters to include demand-only fields.Always set unique aliases for fields that reference foreign keys, e.g., {alias:'GeoCurrent'} for current_geo_id.npm install jorm
Use const Jorm = require('jorm'); instead of import.Ensure you have created the instance: const dto = new Jorm(params, config); then use dto.User.create(...).
Create the table in your database matching the model's table name, or adjust the config.table value.