Registry / database / dead-simple-orm

dead-simple-orm

JSON →
library1.0.8jsnpmunverified

SimpleORM is a minimal, zero-config ORM for TypeScript developers who want to go from zero to one quickly. Current stable version is 1.0.8, released monthly. It simplifies database interactions by eliminating the need for complex schemas, migrations, and entity classes. Unlike heavy ORMs like TypeORM or Prisma, SimpleORM uses a single declaration object to define tables and relationships (one-to-one, one-to-many) and provides basic CRUD operations (insert, list, get, update, delete). It ships inline TypeScript types and depends on TypeScript ^5.0.0 as a peer dependency. Note it does not handle N+1 queries or advanced filtering; it's designed for prototyping and small apps.

npm install dead-simple-orm
INSTALL
IMPORT
SIG · DEAD-SIMPLE-ORM
D
dead-simple-orm
databasejavascriptv1.0.8
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.

SimpleORM
import { SimpleORM } from 'dead-simple-orm'
const SimpleORM = require('dead-simple-orm')
ESM-only package. CommonJS require will fail.
DatabaseDeclaration
import { type DatabaseDeclaration } from 'dead-simple-orm'
import { DatabaseDeclaration } from 'dead-simple-orm'
Type import is required to avoid emitting code when using isolatedModules.
SimpleORM class methods (insert, list, get, update, delete)
import { SimpleORM } from 'dead-simple-orm'; const orm = new SimpleORM(db, declaration); await orm.insert('user', { email: 'a@b.com' })
import { insert } from 'dead-simple-orm'
Methods are instance methods, not exported directly. Must instantiate SimpleORM with a db and declaration.

Initializes SimpleORM with an in-memory SQLite database, defines a User and Post schema with one-to-many relationship, inserts a user and a post, then performs CRUD operations.

import { type DatabaseDeclaration, SimpleORM } from 'dead-simple-orm'; import Database from 'bun:sqlite'; const db = new Database(':memory:'); const dbDeclaration: DatabaseDeclaration = { user: { email: 'text', password: 'text', posts: { type: 'one-to-many', ref: 'post' }, }, post: { title: 'text', body: 'long text', author: { type: 'one-to-one', ref: 'user' }, image: 'image', }, }; const orm = new SimpleORM(db, dbDeclaration); await orm.insert('user', { email: 'test@example.com', password: 'password123' }); const users = await orm.list('user'); const post = await orm.insert('post', { title: 'My First Post', body: 'Body', author: users[0].id, image: 'https://placekitten.com/400/400', }); const fetchedUser = await orm.get(users[0].id); fetchedUser.email = 'updated@example.com'; await orm.update(fetchedUser); await orm.delete(users[0].id);
Debug
Known issues
gotchaN+1 query problem is present: loading related entities (e.g., user's posts) issues separate queries per item.
fix
Manually batch queries or upgrade to a more advanced ORM like Drizzle for production.
affects: >=1.0.0
gotchaOnly supports 'text', 'long text', 'image' as field types. No numeric, boolean, or date types.
fix
Define numeric/boolean fields as 'text' and parse manually, or choose a different ORM.
affects: >=1.0.0 <2.0.0
gotchaPagination and filtering are not supported. All filtering must be done in JavaScript after fetching all rows.
fix
Use array methods like filter() on the result of orm.list() for small datasets.
affects: >=1.0.0
gotchaDatabase driver must be passed as 'db' parameter. Only Bun's sqlite driver is documented; other drivers may fail.
fix
Use a database instance compatible with the expected interface (e.g., createBunSqliteDB from a shim).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'insert')
Attempting to call orm.insert before instantiating SimpleORM with a valid db and declaration.
fix
Ensure you create the ORM instance first: const orm = new SimpleORM(db, declaration);
Module not found: Can't resolve 'dead-simple-orm' in ...
Package not installed or import path incorrect.
fix
Run npm install dead-simple-orm and verify import path is exactly 'dead-simple-orm'.
TypeError: (intermediate value).insert is not a function
Using named import instead of default import with incorrect syntax.
fix
Use: import { SimpleORM } from 'dead-simple-orm' then new SimpleORM(db, decl).insert(...)
Cannot find module 'dead-simple-orm' requiring via CommonJS
Package is ESM-only and does not provide a CommonJS entry.
fix
Use import syntax and ensure your project or tsconfig has "module": "ESNext" or similar.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
typescriptoptionalPeer dependency required for type safety (no runtime dependency).
Agent activity
4 hits · last 30 days
node
4
Resources
dead-simple-orm — npm install dead-simple-orm · libregistry