Registry / database / orange-orm

orange-orm

JSON →
library5.3.4jsnpmunverified

Orange ORM is a TypeScript-first object-relational mapper supporting multiple SQL databases: PostgreSQL, MySQL, SQLite, MSSQL, Oracle, PGlite, and Cloudflare D1. Current stable version is 5.3.4, with an active release cadence. Key differentiators include first-class TypeScript support, automatic inference of TypeORM-like decorators, and compatibility with various Node.js SQL drivers. It emphasizes type safety and provides both active record and data mapper patterns.

npm install orange-orm
INSTALL
IMPORT
SIG · ORANGE-ORM
O
orange-orm
databasejavascriptv5.3.4
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.

Entity
import { Entity } from 'orange-orm';
const { Entity } = require('orange-orm');
ESM-only usage; CJS require() is not supported in v5+.
BaseEntity
import { BaseEntity } from 'orange-orm';
import BaseEntity from 'orange-orm';
BaseEntity is a named export, not a default export.
createConnection
import { createConnection } from 'orange-orm';
import { Connection } from 'orange-orm';
Use createConnection() to initialize; Connection type is not directly exported.

Defines a User entity, creates an in-memory SQLite connection, saves and queries a user.

import { Entity, BaseEntity, createConnection, PrimaryColumn, Column } from 'orange-orm'; @Entity() export class User extends BaseEntity { @PrimaryColumn() id!: number; @Column() name!: string; } async function main() { await createConnection({ type: 'sqlite', database: ':memory:', entities: [User], synchronize: true, }); const user = new User(); user.name = 'Alice'; await user.save(); const users = await User.find(); console.log(users); } main().catch(console.error);
Debug
Known issues
breakingECLASS: undefined is not a valid entity class
fix
Ensure all entity classes are decorated with @Entity() and listed in the entities array of connection options.
affects: >=5.0.0
breakingConnection type not supported: 'mssql'
fix
Use 'mssql' as database type? Actually use 'mssql' only if tedious driver is installed. For newer versions, use 'mssql' with tedious or msnodesqlv8.
affects: >=4.0.0
deprecatedgetConnection() is deprecated. Use getConnection() -> getManager()
fix
Replace getConnection() with getManager() from 'orange-orm'.
affects: >=5.0.0
gotchaCannot use import statement outside a module
fix
Add "type": "module" in package.json or use .mjs extension for ESM.
affects: >=5.0.0
gotchaReflect-metadata is required. Import it before using decorators
fix
Add import 'reflect-metadata' at the top of your entry file.
affects: >=4.0.0
breakingDriver package not installed: pg
fix
Install the appropriate driver: npm install pg for PostgreSQL, npm install mysql2 for MySQL, etc.
affects: >=5.0.0
Errors
Common errors & fixes
Cannot find module 'orange-orm'
Package not installed or import path wrong.
fix
Run npm install orange-orm, then import from 'orange-orm' (not 'orange-orm/src').
Missing required peer dependency: pg
Required database driver not installed.
fix
Install the peer dependency for your database: e.g., npm install pg.
Reflect.getMetadata is not a function
reflect-metadata polyfill not imported.
fix
Add import 'reflect-metadata' at the beginning of your application.
No repository is set for connection. Use 'database' option.
Connection missing database path or name.
fix
Add 'database' property to createConnection options (e.g., database: ':memory:').
Upgrade
Version history
5.3.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources