Registry / database / simple-orm

simple-orm

JSON →
library0.7.0jsnpmunverified

A lightweight and extensible ORM for Node.js focusing on core components: Collections, Repositories, and Models. Version 0.7.0 (stable) supports MySQL/MariaDB with planned adapter-based extensibility for other data stores. Differentiators include a plugin system for custom functionality, hooks into internal operations, and relational terminology. Designed for relational databases, with optional support for NoSQL via adapters.

npm install simple-orm
INSTALL
IMPORT
SIG · SIMPLE-ORM
S
simple-orm
databasejavascriptv0.7.0
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.

Model
import { Model } from 'simple-orm'
const Model = require('simple-orm').Model
ESM import using named export.
Collection
import { Collection } from 'simple-orm'
const { Collection } = require('simple-orm')
CommonJS require is still supported, but ESM is preferred.
Repository
import { Repository } from 'simple-orm'
import Repository from 'simple-orm'
Repository is a named export, not default.

Demonstrates basic usage: define a model with schema, create a repository, save an instance, and fetch all records.

import { Model, Repository, Collection } from 'simple-orm'; class User extends Model { static schema = { tableName: 'users', columns: { id: { type: 'integer', autoIncrement: true, primaryKey: true }, name: { type: 'string' }, email: { type: 'string' } } }; } const repo = new Repository(User); const user = new User({ name: 'Alice', email: 'alice@example.com' }); user.save().then(() => { console.log('User saved'); }); repo.findAll().then(users => { console.log(users); });
Debug
Known issues
gotchaThe ORM assumes Node 0.11.x with --harmony flag or newer; generator support is required for await-style async patterns.
fix
Upgrade to Node >= 0.11.10 and use --harmony flag or transpile with Babel.
affects: <0.7.0
breakingIn v0.7.0, the 'findAll' method's criteria object changed the 'join' property format. Old format { join: { table: '...', on: '...' } } is deprecated; use { join: { table: '...', condition: '...' } }.
fix
Update join criteria to use 'condition' key instead of 'on'.
affects: >=0.7.0
deprecatedPlugin system for Models and Repositories may change in future versions; hooks are currently stable.
fix
Watch changelog for plugin API updates.
affects: <=0.7.0
gotchaOnly MySQL/MariaDB adapters are officially supported. Using other databases requires custom adapter implementation and may lead to unsupported features (e.g., transactions in MongoDB).
fix
Check adapter documentation for supported features before switching.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'simple-orm'
Package not installed or not in node_modules.
fix
Run 'npm install simple-orm' and ensure node_modules is in path.
TypeError: User is not a constructor
Incorrect import style; Model class not properly imported.
fix
Use 'import { Model } from 'simple-orm'' instead of default import.
ReferenceError: require is not defined
Using CommonJS require in an ESM context (e.g., Node with 'type':'module').
fix
Switch to ESM import syntax or rename file to .cjs.
Error: Invalid join condition format
Using old 'on' property instead of 'condition' in join criteria object.
fix
Replace 'on' with 'condition' in join definitions.
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Meta
2
Resources
simple-orm — npm install simple-orm · libregistry