{"id":41269,"library":"humble-node-orm","title":"Humble Node ORM","description":"A didactic, lightweight ORM for Node.js inspired by Rails' ActiveRecord. Version 0.0.53 is the latest stable release. It supports SQLite via a JSON configuration file, provides basic CRUD operations, associations (belongsTo, hasMany), validations, and a simple migration system. Unlike large ORMs like Sequelize or TypeORM, this package focuses on simplicity and learning, with minimal abstraction. Release cadence is irregular—mainly minor patches. Key differentiator: pure JavaScript, no dependencies, and a single-file approach for learning ORM concepts.","status":"active","version":"0.0.53","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install humble-node-orm","lang":"bash","label":"npm"},{"cmd":"yarn add humble-node-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add humble-node-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"SQLite database driver used internally for database connections","package":"better-sqlite3","optional":false},{"reason":"Alternative database driver for SQLite support","package":"sqlite3","optional":true}],"imports":[{"note":"Package is ESM-only. Do not use CommonJS require.","wrong":"const Model = require('humble-node-orm').Model","symbol":"Model","correct":"import { Model } from 'humble-node-orm'"},{"note":"ORM is a named export, not default.","wrong":"import ORM from 'humble-node-orm'","symbol":"ORM","correct":"import { ORM } from 'humble-node-orm'"},{"note":"CLI must be invoked via npx or global install. The command 'humble-migrate migration:run' works only if installed globally.","wrong":"humble-migrate migration:run","symbol":"humble-migrate CLI","correct":"npx humble-migrate migration:create <name>"}],"quickstart":{"code":"import { Model, ORM } from 'humble-node-orm';\n\nclass Post extends Model {\n  constructor(data) {\n    super(data);\n    this.belongsTo(User);\n  }\n}\n\nclass User extends Model {\n  static validations = {\n    pseudo: (value) => value.length > 3\n  };\n  constructor(data) {\n    super(data);\n    this.hasMany(Post);\n  }\n}\n\nconst orm = new ORM({ type: 'sqlite', database: './databases/test.db' });\n\nasync function main() {\n  await orm.connection.query(`CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, pseudo TEXT, password TEXT)`);\n  const newUser = await User.create({ pseudo: 'Alice', password: 'alice123' });\n  console.log('New User:', newUser);\n  const users = await User.all();\n  console.log('All Users:', users);\n  await orm.close();\n}\nmain();","lang":"javascript","description":"Shows basic setup: define models with associations and validations, create a table, insert a record, and query all users."},"warnings":[{"fix":"Place the config file at the project root with the exact name.","message":"Configuration file must be named 'node-orm.config.json' and placed at project root. Other location or name is not supported.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Define associations in the constructor as shown in the docs. Do not define them as static methods.","message":"The 'belongsTo' and 'hasMany' associations are defined inside the constructor using 'this' instead of static properties. This can cause issues with inheritance and multiple instances.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Install globally: 'npm install -g humble-node-orm' then run 'humble-migrate' commands.","message":"Global installation of humble-node-orm is required for CLI migrations. The package does not recommend npx usage in early versions.","severity":"deprecated","affected_versions":"<=0.0.53"},{"fix":"Call the validation function manually in your update logic or override the update method.","message":"Validation is only applied on 'create' and 'save', not on 'update'. If you need validation on update, you must manually call the validation function.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a different ORM for other databases.","message":"The ORM only supports SQLite. There is no support for other databases like PostgreSQL or MySQL.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.53':15 'abstract':58 'activerecord':13 'approach':77 'associ':33 'basic':30 'belongsto':34 'cadenc':60 'concept':81 'configur':27 'crud':31 'depend':71 'didact':5 'differenti':67 'file':28,76 'focus':51 'hasmani':35 'humbl':1 'inspir':10 'irregular':62 'javascript':69,82 'json':26 'key':66 'larg':43 'latest':18 'learn':55,79 'lightweight':6 'like':45 'main':63 'migrat':40 'minim':57 'minor':64 'node':2 'node.js':9 'oper':32 'orm':3,7,44,80 'packag':50 'patch':65 'provid':29 'pure':68 'rail':12 'releas':20,59 'sequel':46 'simpl':39 'simplic':53 'singl':75 'single-fil':74 'sqlite':23 'stabl':19 'support':22 'system':41 'typeorm':48 'unlik':42 'valid':36 'version':14 'via':24","created_at":"2026-06-04T18:51:35.675241+00:00","updated_at":"2026-06-04T18:51:35.675241+00:00","problems":[{"fix":"Install the missing driver: 'npm install better-sqlite3'","cause":"The package depends on 'better-sqlite3' but it's not installed automatically. It is missing from peerDependencies or optionalDependencies.","error":"Error: Cannot find module 'better-sqlite3'"},{"fix":"Use ES6 import syntax: 'import { Model } from 'humble-node-orm''","cause":"Model is not imported correctly, often due to CommonJS require.","error":"TypeError: Class extends value undefined is not a constructor or null"},{"fix":"Create a valid 'node-orm.config.json' at the project root with SQLite type and database path.","cause":"The configuration file is missing or malformed. The ORM falls back to trying a network connection.","error":"Error: getaddrinfo ENOTFOUND localhost"},{"fix":"Create the 'migrations' folder: 'mkdir migrations' or use 'humble-migrate migration:create' to generate files.","cause":"CLI migration commands require a 'migrations' directory at project root. It is not auto-created.","error":"Error: Migration file not found: ./migrations/XXX"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"humble-node-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-04","next_check":"2026-09-02","install_tag":null}}