A lightweight MySQL ORM for Node.js that mimics Mongoose-style chainable queries. Version 2.1.8 is the latest stable release. It operates on 'convention over configuration', deriving table mappings from model names. Supports CRUD operations, transactions, findOne, count, and complex queries via SQL object with and/join. Depends on underscore, x-flow, and node-mysql. Simpler than Sequelize or TypeORM but less feature-rich (no schema creation, migrations, or mapping config).
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.
The module exports the factoryMaster object directly. ESM import not supported.
const master = require('node-entities');
Returns a Factory constructor class.
master.init(opts, models);
Factory class is returned by init, not directly on master before init.
const Factory = master.init(opts, models); const factory = new Factory();
Shows initialization, model definition, insert, and query using node-entities.
const master = require('node-entities');
const models = {
user: function User() {
this.id = { type: Number };
this.name = { type: String };
this.email = { type: String };
}
};
const Factory = master.init({
host: process.env.MYSQL_HOST || 'localhost',
port: process.env.MYSQL_PORT || 3306,
user: process.env.MYSQL_USER || 'root',
password: process.env.MYSQL_PASSWORD || '',
database: process.env.MYSQL_DATABASE || 'test'
}, models);
const factory = new Factory();
// Insert a user
factory.save('user', { name: 'Alice', email: 'alice@example.com' }, function(err, result) {
if (err) console.error(err);
else console.log('Inserted user ID:', result.insertId);
// Query users
factory.find('user', {}, {}, function(err, users) {
if (err) console.error(err);
else console.log('Users:', users);
});
});
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.