Registry / database / forge-orm

forge-orm

JSON →
library1.3.0jsnpmunverified

forge-orm is a multi-database ORM/wrapper (v1.3.0) that provides a Prisma-shaped query API for MongoDB, PostgreSQL, MySQL, and SQLite from a single codebase with no code generation and no query engine. You define models in plain TypeScript and the same queries run against any of the four databases by parsing the connection URL to select the correct driver. It ships TypeScript types, supports relations, transactions, aggregates, full-text search, soft delete, views, and raw SQL. Compared to alternatives like Prisma or Drizzle, forge-orm is significantly smaller (~5,000 lines of TypeScript), has no build step or generated client, and is MIT-licensed. However, it is a young library with a smaller ecosystem and no production track record. Peer dependencies include better-sqlite3, mongodb, mysql2, and pg; you only need to install the driver you require.

database
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.

createDb is a named export, not a default export.

import { createDb } from 'forge-orm'

CommonJS require works but named exports are idiomatic for ESM.

import { f } from 'forge-orm'

model is a named export used to define schema models.

import { model } from 'forge-orm'

InferModel is a TypeScript type export for inferring the row type from a model definition.

import { InferModel } from 'forge-orm'

Defines a User model, creates a database connection, inserts a record, and queries with a filter and limit.

import { createDb, f, model } from 'forge-orm'; const User = model('users', { id: f.id(), email: f.string().unique(), name: f.string(), }); const db = await createDb({ url: process.env.DATABASE_URL ?? 'postgresql://user:pass@localhost/db', schema: { user: User }, }); const alice = await db.user.create({ data: { email: 'alice@example.com', name: 'Alice' }, }); const users = await db.user.findMany({ where: { name: { contains: 'Ali' } }, take: 10, }); console.log(users);
Debug
Known footguns
breakingforge-orm is young and may have breaking changes before v2.0.0.
gotchaPeer dependencies are not installed automatically; you must manually install the driver for your database.
gotchaConnection URL must be a valid database connection string; forge-orm does not validate the URL until connection time.
deprecatedNo known deprecations yet.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
ahrefsbot
2
mj12bot
1
Resources