{"id":44003,"library":"stackerjs-orm","title":"StackerJS ORM","description":"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.","status":"maintenance","version":"1.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/parpeoficial/stackerjs-orm","tags":["javascript","stackerjs","orm","datamapper"],"install":[{"cmd":"npm install stackerjs-orm","lang":"bash","label":"npm"},{"cmd":"yarn add stackerjs-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add stackerjs-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"MySQL database driver for connecting to MySQL databases","package":"mysql","optional":false}],"imports":[{"note":"The package uses ES modules, so import/export is required. CommonJS require will not work without transpilation.","wrong":"const UserRepository = require('./Repositories/UserRepository');","symbol":"UserRepository","correct":"import { UserRepository } from './Repositories/UserRepository'"},{"note":"Entity classes are ES exports. Use named import.","wrong":"const User = require('./Entities/User');","symbol":"User","correct":"import { User } from './Entities/User'"},{"note":"The base Repository class is a named export from the package. CommonJS require will break.","wrong":"const Repository = require('stackerjs-orm');","symbol":"Repository (base)","correct":"import { Repository } from 'stackerjs-orm'"}],"quickstart":{"code":"import { Repository } from 'stackerjs-orm';\n\nclass User {\n  metadata() {\n    return {\n      table: 'users',\n      fields: [\n        { name: 'id', type: 'pk' },\n        { name: 'name', type: 'string', required: true },\n        { name: 'active', type: 'boolean', default: true }\n      ],\n      relations: []\n    };\n  }\n}\n\nclass UserRepository extends Repository {\n  constructor() {\n    super();\n    this.entity = new User();\n  }\n}\n\nasync function main() {\n  const repo = new UserRepository();\n  const user = await repo.findById(1);\n  console.log(user);\n}\n\nmain();","lang":"javascript","description":"Defines an entity with metadata, creates a repository extending the base Repository, and queries by ID."},"warnings":[{"fix":"Use import syntax instead of require().","message":"CommonJS require() will not work; package uses ES modules exclusively.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Always include a 'type' property for each field in the metadata.","message":"Entity fields must be defined with 'type' and optionally 'required' or 'default' - missing field types may cause silent failures.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Ensure you create an instance: const repo = new UserRepository();","message":"Repository must be instantiated with anew() before use; forgetting to call new leads to 'this.entity is undefined' errors.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Consider migrating to an actively maintained ORM like Sequelize or TypeORM.","message":"The package has not been updated since 2019; no support for newer Node.js versions or MySQL 8 features.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Use only valid comparison terms: eq, neq, gt, gte, lt, lte, in, nin.","message":"Filter objects use custom keys like 'eq' instead of standard SQL operators - incorrect key names will be ignored.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'1.4.2':15 '2019':79 '7.10':83 'advanc':105 'api':62 'approach':90 'built':100 'built-in':99 'cadenc':72 'compar':91 'comparison':48 'crud':28 'datamapp':9,111 'datamapper-styl':8 'definit':36 'design':16 'driven':34 'earli':78 'entiti':35 'eq':50 'featur':41 'filter':46 'findal':65 'findbyid':63 'findon':64 'framework':24 'gt':52 'gte':53 'heavier':93 'includ':42 'javascript':108 'key':40 'lack':98 'last':75 'lightweight':7 'like':95 'low':70 'lt':54 'lte':55 'map':107 'metadata':33 'metadata-driven':32 'migrat':102 'minimalist':89 'mysql':45 'neq':51 'nin':57 'node.js':13,82 'oper':29,49 'orm':2,4,11,94,110 'outsid':21 'packag':67 'pattern':39 'provid':26 'queri':61 'relationship':106 'releas':71 'repositori':38 'requir':81 'sequel':96 'simpl':60 'stackerj':1,3,23,109 'stand':85 'straightforward':27 'style':10 'support':43 'tool':103 'updat':76 'use':18 'version':14 'within':19","created_at":"2026-06-05T17:02:30.873456+00:00","updated_at":"2026-06-05T17:02:30.873456+00:00","problems":[{"fix":"Add this.entity = new User(); inside your repository constructor.","cause":"Repository constructor did not set this.entity to an entity instance.","error":"TypeError: this.entity is undefined"},{"fix":"Replace require() with import statements.","cause":"Using CommonJS require() in an ES module environment.","error":"ReferenceError: require is not defined"},{"fix":"Add 'type': 'module' in package.json or use .mjs file extension.","cause":"Trying to run ES module code without proper module configuration.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/parpeoficial/stackerjs-orm#readme","github":"https://github.com/parpeoficial/stackerjs-orm","docs":null,"changelog":null,"pypi":null,"npm":"stackerjs-orm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}