{"id":41117,"library":"forge-orm","title":"forge-orm","description":"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.","status":"active","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/johnsonfash/forge-orm","tags":["javascript","orm","prisma","mongodb","postgres","postgresql","mysql","sqlite","database","typescript"],"install":[{"cmd":"npm install forge-orm","lang":"bash","label":"npm"},{"cmd":"yarn add forge-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add forge-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"SQLite driver — required only if using SQLite","package":"better-sqlite3","optional":true},{"reason":"MongoDB driver — required only if using MongoDB","package":"mongodb","optional":true},{"reason":"MySQL driver — required only if using MySQL","package":"mysql2","optional":true},{"reason":"PostgreSQL driver — required only if using PostgreSQL","package":"pg","optional":true}],"imports":[{"note":"createDb is a named export, not a default export.","wrong":"import createDb from 'forge-orm'","symbol":"createDb","correct":"import { createDb } from 'forge-orm'"},{"note":"CommonJS require works but named exports are idiomatic for ESM.","wrong":"const f = require('forge-orm').f","symbol":"f","correct":"import { f } from 'forge-orm'"},{"note":"model is a named export used to define schema models.","wrong":"","symbol":"model","correct":"import { model } from 'forge-orm'"},{"note":"InferModel is a TypeScript type export for inferring the row type from a model definition.","wrong":"","symbol":"InferModel","correct":"import { InferModel } from 'forge-orm'"}],"quickstart":{"code":"import { createDb, f, model } from 'forge-orm';\n\nconst User = model('users', {\n  id: f.id(),\n  email: f.string().unique(),\n  name: f.string(),\n});\n\nconst db = await createDb({\n  url: process.env.DATABASE_URL ?? 'postgresql://user:pass@localhost/db',\n  schema: { user: User },\n});\n\nconst alice = await db.user.create({\n  data: { email: 'alice@example.com', name: 'Alice' },\n});\n\nconst users = await db.user.findMany({\n  where: { name: { contains: 'Ali' } },\n  take: 10,\n});\n\nconsole.log(users);","lang":"typescript","description":"Defines a User model, creates a database connection, inserts a record, and queries with a filter and limit."},"warnings":[{"fix":"Pin to a specific version and test upgrades carefully.","message":"forge-orm is young and may have breaking changes before v2.0.0.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Run `npm install pg` (or mysql2, better-sqlite3, mongodb) alongside forge-orm.","message":"Peer dependencies are not installed automatically; you must manually install the driver for your database.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure DATABASE_URL is set correctly for your chosen database (e.g., postgresql://, mysql://, sqlite://, mongodb://).","message":"Connection URL must be a valid database connection string; forge-orm does not validate the URL until connection time.","severity":"gotcha","affected_versions":"*"},{"fix":"","message":"No known deprecations yet.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"search_vec":"'000':99 '5':98 'aggreg':74 'altern':87 'api':21 'better':134 'better-sqlite3':133 'build':105 'client':109 'code':34 'codebas':31 'compar':85 'connect':60 'correct':65 'databas':11,56,157 'defin':41 'delet':80 'depend':131 'driver':66,146 'drizzl':91 'ecosystem':124 'engin':39 'forg':2,5,93 'forge-orm':1,4,92 'four':55 'full':76 'full-text':75 'generat':35,108 'howev':115 'includ':132 'instal':144 'javascript':149 'librari':120 'licens':114 'like':88 'line':100 'mit':113 'mit-licens':112 'model':42 'mongodb':23,136,152 'multi':10 'multi-databas':9 'mysql':25,155 'mysql2':137 'need':142 'orm':3,6,94,150 'orm/wrapper':12 'pars':58 'peer':130 'pg':139 'plain':44 'postgr':153 'postgresql':24,154 'prisma':18,89,151 'prisma-shap':17 'product':127 'provid':15 'queri':20,38,49 'raw':83 'record':129 'relat':72 'requir':148 'run':50 'search':78 'select':63 'shape':19 'ship':68 'signific':96 'singl':30 'smaller':97,123 'soft':79 'sql':84 'sqlite':27,156 'sqlite3':135 'step':106 'support':71 'text':77 'track':128 'transact':73 'type':70 'typescript':45,69,102,158 'url':61 'v1.3.0':13 'view':81 'young':119","created_at":"2026-06-04T18:50:51.591278+00:00","updated_at":"2026-06-04T18:50:51.591278+00:00","problems":[{"fix":"Install the required driver: npm install pg (replace with your driver).","cause":"Missing peer dependency for the database driver.","error":"Cannot find module 'pg' (or 'mysql2', etc.)"},{"fix":"Use `import { createDb } from 'forge-orm'` instead of `import createDb from 'forge-orm'`.","cause":"Incorrect import: createDb imported as default instead of named export.","error":"TypeError: createDb is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/johnsonfash/forge-orm#readme","github":"https://github.com/johnsonfash/forge-orm","docs":null,"changelog":null,"pypi":null,"npm":"forge-orm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}