Registry / database / stackerjs-orm

stackerjs-orm

JSON →
library1.4.2jsnpmunverified

StackerJS ORM is a lightweight DataMapper-style ORM for Node.js, version 1.4.2. Designed for use within or outside the StackerJS framework, it provides straightforward CRUD operations with a metadata-driven entity definition and repository pattern. Key features include support for MySQL, filtering with comparison operators (eq, neq, gt, gte, lt, lte, in, nin), and a simple query API (findById, findOne, findAll). The package has a low release cadence, with the last update in early 2019, and requires Node.js >=7.10. It stands out for its minimalistic approach compared to heavier ORMs like Sequelize, but lacks built-in migration tools and advanced relationship mapping.

npm install stackerjs-orm
INSTALL
IMPORT
SIG · STACKERJS-ORM
S
stackerjs-orm
databasejavascriptv1.4.2
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.

UserRepository
import { UserRepository } from './Repositories/UserRepository'
const UserRepository = require('./Repositories/UserRepository');
The package uses ES modules, so import/export is required. CommonJS require will not work without transpilation.
User
import { User } from './Entities/User'
const User = require('./Entities/User');
Entity classes are ES exports. Use named import.
Repository (base)
import { Repository } from 'stackerjs-orm'
const Repository = require('stackerjs-orm');
The base Repository class is a named export from the package. CommonJS require will break.

Defines an entity with metadata, creates a repository extending the base Repository, and queries by ID.

import { Repository } from 'stackerjs-orm'; class User { metadata() { return { table: 'users', fields: [ { name: 'id', type: 'pk' }, { name: 'name', type: 'string', required: true }, { name: 'active', type: 'boolean', default: true } ], relations: [] }; } } class UserRepository extends Repository { constructor() { super(); this.entity = new User(); } } async function main() { const repo = new UserRepository(); const user = await repo.findById(1); console.log(user); } main();
Debug
Known issues
breakingCommonJS require() will not work; package uses ES modules exclusively.
fix
Use import syntax instead of require().
affects: >=1.0
gotchaEntity fields must be defined with 'type' and optionally 'required' or 'default' - missing field types may cause silent failures.
fix
Always include a 'type' property for each field in the metadata.
affects: >=1.0
gotchaRepository must be instantiated with anew() before use; forgetting to call new leads to 'this.entity is undefined' errors.
fix
Ensure you create an instance: const repo = new UserRepository();
affects: >=1.0
deprecatedThe package has not been updated since 2019; no support for newer Node.js versions or MySQL 8 features.
fix
Consider migrating to an actively maintained ORM like Sequelize or TypeORM.
affects: >=1.0
gotchaFilter objects use custom keys like 'eq' instead of standard SQL operators - incorrect key names will be ignored.
fix
Use only valid comparison terms: eq, neq, gt, gte, lt, lte, in, nin.
affects: >=1.0
Errors
Common errors & fixes
TypeError: this.entity is undefined
Repository constructor did not set this.entity to an entity instance.
fix
Add this.entity = new User(); inside your repository constructor.
ReferenceError: require is not defined
Using CommonJS require() in an ES module environment.
fix
Replace require() with import statements.
SyntaxError: Unexpected token 'export'
Trying to run ES module code without proper module configuration.
fix
Add 'type': 'module' in package.json or use .mjs file extension.
Upgrade
Version history
1.4.2latest on npm
Audit
Dependencies
mysqlrequiredMySQL database driver for connecting to MySQL databases
Agent activity
13 hits · last 30 days
node
10
Meta
2
OpenAI (training)
1
Resources
stackerjs-orm — npm install stackerjs-orm · libregistry