Registry / database / orm
library8.0.1jsnpmunverified

Node.js Object Relational Mapping (ORM) library supporting MySQL, PostgreSQL, Amazon Redshift, SQLite, and MongoDB (beta). Version 8.0.1 is the latest stable release, but the package is not actively maintained. For new projects, alternatives like TypeORM or Sequelize are recommended due to more active communities. It supports model creation, associations, validations, caching, and plugins. Offers a simple callback-based API with Express middleware integration.

npm install orm
INSTALL
IMPORT
SIG · ORM
O
orm
databasejavascriptv8.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import orm from 'orm'
const orm = require('orm');
CommonJS is still widely used and supported for this package. ESM import works in modern Node.
orm.connect
import orm from 'orm'; orm.connect(url, callback)
const { connect } = require('orm'); connect(url, callback);
Named import for connect may not be available; use default import then call orm.connect.
orm.express middleware
import orm from 'orm'; app.use(orm.express(url, options))
const { express } = require('orm'); app.use(express(url, options));
Use default import to access orm.express middleware.

Connects to a MySQL database, defines a Person model, syncs the schema, creates a record, queries it, and updates the age.

import orm from 'orm'; // Connect to MySQL database orm.connect(process.env.DATABASE_URL || 'mysql://root:password@localhost/test', (err, db) => { if (err) throw err; // Define a model const Person = db.define('person', { name: String, age: Number, email: { type: 'text', size: 100 }, }); // Sync database (create table) db.sync(() => { // Create a record Person.create({ name: 'Alice', age: 30, email: 'alice@example.com' }, (err, person) => { if (err) throw err; console.log('Created person:', person.id, person.name); // Find records Person.find({ name: 'Alice' }, (err, people) => { if (err) throw err; console.log('Found:', people.length); // Update people[0].age = 31; people[0].save((err) => { if (err) throw err; console.log('Updated age'); }); }); }); }); });
Debug
Known issues
deprecatedPackage is not actively maintained. Consider using TypeORM or Sequelize for new projects.
fix
Migrate to a supported ORM like TypeORM (github.com/typeorm/typeorm) or Sequelize (github.com/sequelize/sequelize).
affects: >=8.0.0
breakingMongoDB support is beta and does not work with Node >= 8. Also missing aggregation features.
fix
Use a dedicated MongoDB ODM like Mongoose if you need MongoDB support.
affects: >=8.0.0
gotchaIf using Node >= 14 and PostgreSQL, you must use pg driver >= 8.1. pg v7 doesn't work correctly (tests time out).
fix
Install pg version 8.1 or later: npm install pg@>=8.1
affects: >=7.0.0
Errors
Common errors & fixes
Error: Cannot find module 'orm'
Package not installed
fix
Run: npm install orm
Error: connect ECONNREFUSED 127.0.0.1:3306
MySQL server not running or wrong host/port
fix
Ensure MySQL is running on the expected host/port, or change the connection URL.
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Incorrect database credentials
fix
Check username and password in the connection string, or create a proper user with permissions.
TypeError: orm.connect is not a function
Default import not used correctly in CommonJS
fix
Use: const orm = require('orm'); orm.connect(...)
Upgrade
Version history
8.0.1latest on npm
Audit
Dependencies
pgoptionalPostgreSQL driver; for Node >= 14 & Postgres, must use pg >= 8.1 because pg v7 causes test timeouts
sqlite3optionalSQLite driver
mysql2optionalMySQL driver
Agent activity
6 hits · last 30 days
node
6
Resources
packageorm
orm — npm install orm · libregistry