{"id":43402,"library":"naomi","title":"Naomi ORM","description":"Naomi is a simple, productive ORM for Node.js (v2.2.1) that handles repetitive CRUD tasks while allowing custom SQL queries. It uses mongo-like query syntax and leverages existing database metadata instead of redefining schemas. It supports MySQL (via naomi-mysql connector) and exposes both promise and callback APIs. Key differentiators: schema auto-discovery, lightweight design, and a unified interface for CRUD and native queries. Development appears slow with no recent updates, suggesting maintenance mode.","status":"maintenance","version":"2.2.1","language":"javascript","source_language":"en","source_url":"git://github.com/jmike/naomi","tags":["javascript","database","db","relational","sql","query","client","model","mysql"],"install":[{"cmd":"npm install naomi","lang":"bash","label":"npm"},{"cmd":"yarn add naomi","lang":"bash","label":"yarn"},{"cmd":"pnpm add naomi","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"MySQL connector required for database operations","package":"naomi-mysql","optional":false}],"imports":[{"note":"Naomi uses CommonJS; no ESM exports in v2.","wrong":"import naomi from 'naomi'","symbol":"naomi","correct":"const naomi = require('naomi')"},{"note":"Must use the Naomi-specific connector, not the raw mysql driver.","wrong":"const mysql = require('mysql')","symbol":"mysql connector","correct":"const mysql = require('naomi-mysql')"},{"note":"Use naomi.create() factory method, not constructor.","wrong":"const db = new naomi.Database(config)","symbol":"Database instance","correct":"const db = naomi.create('mysql', config)"}],"quickstart":{"code":"const naomi = require('naomi');\nconst mysql = require('naomi-mysql');\n\nnaomi.register('mysql', mysql);\n\nconst db = naomi.create('mysql', {\n  host: process.env.DB_HOST ?? 'localhost',\n  port: 3306,\n  user: process.env.DB_USER ?? 'user',\n  password: process.env.DB_PASS ?? '',\n  database: process.env.DB_NAME ?? 'test',\n});\n\ndb.connect()\n  .then(() => {\n    const employees = db.collection('employees');\n    return employees.reverseEngineer();\n  })\n  .then(() => employees.find({}))\n  .then((results) => {\n    console.log(results);\n    return db.disconnect();\n  })\n  .catch((err) => console.error(err));","lang":"javascript","description":"Connects to MySQL, reverse-engineers schema from 'employees' table, and fetches all records."},"warnings":[{"fix":"Upgrade Node.js to version 4 or later.","message":"Node.js >=4.0.0 required; older versions unsupported","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Ensure database schema exists before using reverseEngineer().","message":"No built-in migrations or models; relies on reverse engineering schema from database","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use .then()/.catch() or async/await instead of callbacks.","message":"Callback API deprecated in favor of promises","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Process stream chunks with backpressure or use pagination.","message":"Collection#findStream() may cause memory issues with large datasets","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'allow':18 'api':52 'appear':71 'auto':57 'auto-discoveri':56 'callback':51 'client':86 'connector':45 'crud':15,66 'custom':19 'databas':32,81 'db':82 'design':60 'develop':70 'differenti':54 'discoveri':58 'exist':31 'expos':47 'handl':13 'instead':34 'interfac':64 'javascript':80 'key':53 'leverag':30 'lightweight':59 'like':26 'mainten':78 'metadata':33 'mode':79 'model':87 'mongo':25 'mongo-lik':24 'mysql':40,44,88 'naomi':1,3,43 'naomi-mysql':42 'nativ':68 'node.js':10 'orm':2,8 'product':7 'promis':49 'queri':21,27,69,85 'recent':75 'redefin':36 'relat':83 'repetit':14 'schema':37,55 'simpl':6 'slow':72 'sql':20,84 'suggest':77 'support':39 'syntax':28 'task':16 'unifi':63 'updat':76 'use':23 'v2.2.1':11 'via':41","created_at":"2026-06-05T16:59:37.466725+00:00","updated_at":"2026-06-05T16:59:37.466725+00:00","problems":[{"fix":"npm install naomi-mysql --save","cause":"naomi-mysql connector not installed","error":"Error: Cannot find module 'naomi-mysql'"},{"fix":"Use const naomi = require('naomi') (CommonJS).","cause":"Incorrect import (e.g., default ES import vs require)","error":"TypeError: naomi.create is not a function"}],"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/jmike/naomi#readme","github":"git://github.com/jmike/naomi","docs":null,"changelog":null,"pypi":null,"npm":"naomi","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}}