Automated migration from Prisma to @mostajs/orm.
npx @mostajs/orm-cli bootstrapscans your Prisma project, rewrites everynew PrismaClient(...)site to use the @mostajs/orm-bridge (backing up the originals), installs the runtime, converts your schema, and applies DDL — in one command.
cd my-existing-prisma-app
npx @mostajs/orm-cli bootstrap
npm run dev
# db.User.findMany(...) now runs on any of 13 databases. Zero code change.That single command does :
- Codemod — scans the repo for
new PrismaClient(...), detects each export name (prisma,db,client, default), and rewrites each site tocreatePrismaLikeDb()from@mostajs/orm-bridge. Originals backed up as*.prisma.bak. - Install —
@mostajs/orm+@mostajs/orm-bridge+@mostajs/orm-adapter+server-only. - Convert —
prisma/schema.prisma→.mostajs/generated/entities.json. - DDL — writes
.mostajs/config.env(SQLite defaults) and creates tables.
Every step stops on error (v0.4.1+) so you never see a lying success banner.
To undo :
npx @mostajs/orm-cli install-bridge --restore --applynpx @mostajs/orm-cli bootstrapnpm install -g @mostajs/orm-cli
cd your/project
mostajs bootstrap| Command | What it does |
|---|---|
mostajs bootstrap |
Full migration : codemod + install + convert + DDL |
mostajs install-bridge |
Run the codemod (dry-run by default) |
mostajs install-bridge --apply |
Write the codemod changes |
mostajs install-bridge --file <path> |
Restrict to one file |
mostajs install-bridge --restore --apply |
Revert .prisma.bak backups |
mostajs convert |
Auto-detect schema (Prisma / OpenAPI / JSONSchema) and convert |
mostajs detect |
Print what's detected in the project |
mostajs health |
Verify Node / pnpm / schemas / entities.json state |
mostajs hash <password> [cost] |
Bcrypt a password (for seed data) |
mostajs verify <password> <hash> |
Check a password/hash pair |
mostajs diagnose [email] [password] |
Walk through login diagnostics |
mostajs help |
Usage |
mostajs version |
Print version |
cd your/project
mostajsDetected schemas are listed. Pick :
1) Convert schema → EntitySchema[]
2) Configure database URIs
3) Initialize dialects (connect + create tables)
4) Tests menu (human / mobile / AI agent / curl / playwright)
5) Start services
6) Metrics & status
7) View logs
8) Health checks
9) Generate boilerplate (src/db.ts / .env.example)
s) Seeding (upload / validate / hash / apply)
b) Bootstrap — one-shot Prisma migration
i) Install bridge (codemod)
0) About / Help
q) Quit
mostajs install-bridge is safe by default — dry-run reports what it would change, without touching files :
$ mostajs install-bridge
▶ mostajs install-bridge — scanning /home/me/my-app
Found 3 PrismaClient instantiation site(s):
→ src/lib/db.ts (const db)
→ src/server/prisma.ts (const prisma)
→ scripts/seed.ts (const prisma)
Dry-run — no files written. Re-run with --apply to execute.
Detection rules :
- Must contain
import ... from '@prisma/client'ANDnew PrismaClient( - Files that already use
@mostajs/orm-bridge/prisma-clientare skipped (idempotent re-runs) - Export shape is preserved :
const db,const prisma,let client,export default, andconst x = ...; export { x }
Replacement format :
// Auto-generated by `mostajs install-bridge` on 2026-04-14T02:03:38Z
// Original file backed up as <this-file>.prisma.bak
// Every db/prisma/client call is now routed to @mostajs/orm (13 dialects).
import { createPrismaLikeDb } from '@mostajs/orm-bridge/prisma-client'
export const db = createPrismaLikeDb()The CLI auto-detects :
- Prisma —
prisma/schema.prisma - OpenAPI —
openapi.yaml,openapi.json,api.yaml,spec/openapi.yaml, … - JSON Schema —
schemas/*.json
Conversion goes through @mostajs/orm-adapter (4 adapters).
SQLite · PostgreSQL · MySQL · MariaDB · MongoDB · Oracle · SQL Server · CockroachDB · DB2 · SAP HANA · HSQLDB · Spanner · Sybase
Switch database by editing .mostajs/config.env (or .env) :
DB_DIALECT=postgres
SGBD_URI=postgres://user:pass@host:5432/mydbThen re-run mostajs → menu 3 (init DDL) → menu S → 4 (apply seeds). Same code.
your-project/
├── prisma/schema.prisma # unchanged
├── src/lib/db.ts # 3 lines now (createPrismaLikeDb)
├── src/lib/db.ts.prisma.bak # original, in case you want to revert
└── .mostajs/
├── config.env # DB_DIALECT, SGBD_URI, DB_SCHEMA_STRATEGY
├── generated/entities.json # converted schema (13-DB-ready)
├── seeds/*.json # one per entity, hashed by menu S → h
└── logs/ # convert / init / seed / dev
FitZoneGym (production-grade Next.js 15 + Prisma, 40 models, 67 files importing Prisma) was migrated end-to-end with :
cd FitZoneGym
npx @mostajs/orm-cli bootstrap # 15 PrismaClient sites rewritten, schema converted, DDL applied
# manually : add seeds to .mostajs/seeds/User.json
# manually : mostajs — menu S → h → 4
npm run dev # login alice@example.com / alice123 → 302 + sessionFiles modified by the user : 0 (codemod owned them all). Login, dashboard, API routes all work on SQLite instead of MongoDB.
AGPL-3.0-or-later + commercial license available.
For closed-source commercial use : drmdh@msn.com
- @mostajs/orm — the ORM (13 databases)
- @mostajs/orm-bridge — runtime drop-in for PrismaClient
- @mostajs/orm-adapter — schema format converters
Dr Hamid MADANI drmdh@msn.com