Registry / database / nexorm

nexorm

JSON →
library2.0.5jsnpmunverified

A powerful TypeScript ORM that supports SQLite, PostgreSQL, and MySQL via drivers like better-sqlite3, pg, and tedious. Version 2.0.5 is the latest stable release, with active development and monthly releases. Key differentiators include a simple, type-safe API with automatic migration generation, support for eager and lazy loading, and a lightweight footprint compared to heavier ORMs like Sequelize or TypeORM.

npm install nexorm
INSTALL
IMPORT
SIG · NEXORM
N
nexorm
databasejavascriptv2.0.5
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.

NexORM
import { NexORM } from 'nexorm'
import NexORM from 'nexorm'
Named export only; default import will fail.
Model
import { Model } from 'nexorm'
import { Model } from 'nexorm/models'
Model is exported from the main package, not a subpath.
QueryBuilder
import { QueryBuilder } from 'nexorm'
const QueryBuilder = require('nexorm').QueryBuilder
CJS require works but TypeScript prefers ESM import.
Schema
import { Schema } from 'nexorm'
Schema is available since v2.0.0; deprecated in v1.x as 'Migration'.

Shows how to define a model with schema, connect to SQLite, run migrations, and create a record.

import { NexORM, Model, Schema } from 'nexorm'; const db = new NexORM({ client: 'sqlite', connection: { filename: './test.db' } }); class User extends Model { static schema = new Schema({ id: { type: 'integer', primary: true }, name: { type: 'string' }, email: { type: 'string', unique: true } }); } await db.connect(); await db.migrate(); const user = await User.create({ name: 'Alice', email: 'alice@example.com' }); console.log(user.name); // 'Alice' await db.close();
Debug
Known issues
breakingv2.0.0 changed the API from v1.x: 'Model.create' now returns the created instance instead of a promise resolving to the instance.
fix
Update code that awaited create() with .then() pattern; use await directly.
affects: >=2.0.0 <3.0.0
deprecatedThe 'Migration' class was renamed to 'Schema' in v2.0.0.
fix
Replace 'Migration' with 'Schema' in imports and usage.
affects: >=1.0.0 <2.0.0
gotchaSQLite driver (better-sqlite3) is required even if using PostgreSQL; NexORM downloads it as a dependency but it may cause native build issues on some platforms.
fix
Ensure build tools are present; or use optional dependency flags.
affects: >=2.0.0
gotchaWhen using MySQL, the driver 'tedious' may not be compatible with newer MySQL versions; prefer 'mysql2' but NexORM does not support it natively.
fix
Use PostgreSQL or SQLite for now, or manually patch drivers.
affects: >=2.0.0
deprecatedThe 'raw' query method is marked for removal in v3.0.0; use QueryBuilder.executeRaw() instead.
fix
Replace raw() calls with QueryBuilder.executeRaw().
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'better-sqlite3'
Optional dependency not installed on the user's system.
fix
Run 'npm install better-sqlite3' manually, or switch to a different database.
TypeError: NexORM is not a constructor
Default import used instead of named import.
fix
Use 'import { NexORM } from 'nexorm'' instead of default import.
ECONNREFUSED connection to PostgreSQL
Connection configuration incorrect or database service not running.
fix
Check host, port, and credentials; ensure PostgreSQL is running and accessible.
Upgrade
Version history
2.0.5latest on npm
Audit
Dependencies
better-sqlite3optionalDriver for SQLite support
pgoptionalDriver for PostgreSQL support
tediousoptionalDriver for MySQL/MSSQL support
Agent activity
4 hits · last 30 days
node
4
Resources
packagenexorm
nexorm — npm install nexorm · libregistry