Part of the app that runs on any of 13 databases — and you don't edit a single line of application code:
CODEcd my-existing-prisma-app
npx @mostajs/orm-cli bootstrap
npm run dev
# db.User.findMany(...) now runs on SQLite / Postgres / MySQL / Mongo / Oracle / … — same code.
- A codemod rewrites every
new PrismaClient(...), backs the originals up, and is reversible.
- Every step stops on the first error — no lying success banner.
- Real proof: a 40-model, 67-file Next.js app migrated end-to-end with 0 files touched by hand.
The problem: Prisma marries you to one database
Prisma is great until the day you need a different database — Mongo for one service, Postgres for another, SQLite for local dev or an embedded build, Oracle because the client mandates it. Prisma's schema, client and migrations are tied to one provider; switching means rewriting data access across the whole codebase.
@mostajs/orm-cliremoves that wall. Its headline command,mostajs bootstrap, performs the migration for you — codemod included — so the samedb.User.findMany()calls keep working, now on top of an ORM that speaks 13 dialects.
Whatmostajs bootstrapactually does
Four steps, each gated on the previous succeeding (v0.4.1+):
Codemod — scans the repo fornew PrismaClient(...), detects each export name (prisma,db,client, default…), and rewrites each site tocreatePrismaLikeDb()from@mostajs/orm-bridge. Originals saved as*.prisma.bak.
Install — adds@mostajs/orm+@mostajs/orm-bridge+@mostajs/orm-adapter.
Convert —prisma/schema.prisma→.mostajs/generated/entities.json(a 13-database-ready schema).
DDL — writes.mostajs/config.env(SQLite defaults) and creates the tables.
The "zero code change" isn't a slogan:
@mostajs/orm-bridgeexposes a Prisma-compatible client, so yourdb.user.findMany(...)calls hit it unchanged. The codemod just swaps whatdbis.
Safe by default, and reversible
The codemod (
mostajs install-bridge) is dry-run by default — it reports, it doesn't write:
CODE$ mostajs install-bridge
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.
It only acts on files that import
@prisma/clientand callnew PrismaClient(— and it skips files already migrated, so re-runs are idempotent. Every rewritten file leaves a.prisma.baknext to it, and one command rolls the whole thing back:
CODEnpx @mostajs/orm-cli install-bridge --restore --apply
No black box: you can see what changed, and you can undo it.
Pick your database afterwards
Bootstrap configures SQLite so it works immediately. To target any of the other twelve, edit
.mostajs/config.env:
CODEDB_DIALECT=postgres
SGBD_URI=postgres://user:pass@host:5432/mydb
The thirteen: SQLite · PostgreSQL · MySQL · MariaDB · MongoDB · Oracle · SQL Server · CockroachDB · DB2 · SAP HANA · HSQLDB · Spanner · Sybase. Same converted schema, same application code — you change two env lines and re-init.
Not just Prisma at the input
The converter auto-detects more than Prisma schemas — it also reads OpenAPI (
openapi.yaml/json) and JSON Schema (schemas/*.json), routing through@mostajs/orm-adapter. So "I have an API spec but no ORM" is also a starting point, not just "I have Prisma".
Proof — FitZoneGym
This isn't a toy demo. FitZoneGym — a production-grade Next.js 15 + Prisma app, 40 models, 67 files importing Prisma — was migrated with one bootstrap:
CODEcd FitZoneGym
npx @mostajs/orm-cli bootstrap # 15 PrismaClient sites rewritten, schema converted, DDL applied
npm run dev # login [email protected] → 302 + session, on SQLite instead of MongoDB
Files edited by hand: 0 — the codemod owned them all. Login, dashboard and API routes ran on SQLite instead of MongoDB, unchanged.
More than migration
Beyond
bootstrap, the CLI carries the everyday utilities you actually need around a database:mostajs health(Node / schema /entities.jsonchecks),mostajs detect(what's in the project),mostajs hash/verify(bcrypt for seed data),mostajs diagnose(login walkthrough), and a full interactive menu (mostajswith no args) for converting, configuring URIs, init/DDL, seeding, services and logs.
One caveat worth stating: this package is an executable, not a library — install and run it, don't
importfrom it.
Where it fits
mostajs bootstrapis the on-ramp to (the bootstrap uses that engine internally). For ongoing replication, see
🐙 GitHub —
If escaping single-database lock-in with one reversible command is useful, a ⭐ on GitHub helps — it's the signal AI dev tools use to surface the package.
Auteur : Dr Hamid MADANI [email protected]
↗ Original-Artikel auf dev.to lesenVollständiger Original-BerichtAusführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
Ähnliche Beiträge
Auch interessante Nachrichten Migrate a Prisma project to Postgres, MySQL, Mongo — or 10 other databases — with zero code change, using @mostajs/orm-cli
Thematisch verwandte Begriffe: Migrate, Prisma, project, Postgres · 6 Treffer
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
SOCIAL SHARE CARD GENERATOR