Registry / database / naomi
library2.2.1jsnpmunverified

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.

npm install naomi
INSTALL
IMPORT
SIG · NAOMI
N
naomi
databasejavascriptv2.2.1
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.

naomi
✓ const naomi = require('naomi')
✗ import naomi from 'naomi'
Naomi uses CommonJS; no ESM exports in v2.
mysql connector
✓ const mysql = require('naomi-mysql')
✗ const mysql = require('mysql')
Must use the Naomi-specific connector, not the raw mysql driver.
Database instance
✓ const db = naomi.create('mysql', config)
✗ const db = new naomi.Database(config)
Use naomi.create() factory method, not constructor.

Connects to MySQL, reverse-engineers schema from 'employees' table, and fetches all records.

const naomi = require('naomi'); const mysql = require('naomi-mysql'); naomi.register('mysql', mysql); const db = naomi.create('mysql', { host: process.env.DB_HOST ?? 'localhost', port: 3306, user: process.env.DB_USER ?? 'user', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'test', }); db.connect() .then(() => { const employees = db.collection('employees'); return employees.reverseEngineer(); }) .then(() => employees.find({})) .then((results) => { console.log(results); return db.disconnect(); }) .catch((err) => console.error(err));
Debug
Known issues
breakingNode.js >=4.0.0 required; older versions unsupported
fix
Upgrade Node.js to version 4 or later.
affects: <2.0.0
gotchaNo built-in migrations or models; relies on reverse engineering schema from database
fix
Ensure database schema exists before using reverseEngineer().
affects: >=2.0.0
deprecatedCallback API deprecated in favor of promises
fix
Use .then()/.catch() or async/await instead of callbacks.
affects: >=2.0.0
gotchaCollection#findStream() may cause memory issues with large datasets
fix
Process stream chunks with backpressure or use pagination.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'naomi-mysql'
naomi-mysql connector not installed
fix
npm install naomi-mysql --save
TypeError: naomi.create is not a function
Incorrect import (e.g., default ES import vs require)
fix
Use const naomi = require('naomi') (CommonJS).
Upgrade
Version history
2.2.1latest on npm
Audit
Dependencies
naomi-mysqlrequiredMySQL connector required for database operations
Agent activity
6 hits · last 30 days
node
6
Resources
packagenaomi ↗
naomi — npm install naomi · libregistry