I'm Hamid — Software Engineer & Ophthalmologist in Algeria.
My clinic's software needed to run on Oracle (government mandate), but my team writes TypeScript with Prisma.
Prisma doesn't support Oracle. Rewriting everything wasn't an option.
So I built @mostajs/orm — a Hibernate-inspired ORM with 13 database backends.
## The problem
Prisma is excellent for DX. But:
- 6 databases (PostgreSQL, MySQL, SQLite, MongoDB, SQL Server, CockroachDB). No Oracle. No DB2. No SAP HANA.
- 30MB engine binary shipped with every deployment
- 100K-line generated client that grows with your schema
- No cross-dialect replication
If your enterprise client says "we use Oracle" — you're stuck.
## The solution
@mostajs/orm — one API, 13 databases:
SQLite · PostgreSQL · MySQL · MariaDB · MongoDB · Oracle · SQL Server · CockroachDB · DB2 · SAP HANA · HSQLDB ·
Spanner · Sybase
bash
npm install @mostajs/orm better-sqlite3
import { registerSchemas, getDialect, BaseRepository } from '@mostajs/orm'
registerSchemas([UserSchema])
const dialect = await getDialect() // reads DB_DIALECT from .env
const repo = new BaseRepository(UserSchema, dialect)
await repo.create({ email: 'ada@shop.io', name: 'Ada' })
await repo.findAll({ status: 'active' })
Switch databases with one env var. Same code everywhere.
No engine, no codegen
┌───────────────┬───────────────────────────────────────┬───────────────────────────────┐
│ │ Prisma │ @mostajs/orm │
├───────────────┼───────────────────────────────────────┼───────────────────────────────┤
│ Engine │ 30MB WASM binary │ None — ~200 lines per dialect │
├───────────────┼───────────────────────────────────────┼───────────────────────────────┤
│ Codegen │ 100K-line generated client │ Plain objects (EntitySchema) │
├───────────────┼───────────────────────────────────────┼───────────────────────────────┤
│ Databases │ 6 │ 13 │
├───────────────┼───────────────────────────────────────┼───────────────────────────────┤
│ Bundle impact │ Heavy (serverExternalPackages needed) │ Lazy-loaded, bundler-friendly │
└───────────────┴───────────────────────────────────────┴───────────────────────────────┘
Already using Prisma? 3-line migration
// Before (Prisma)
import { PrismaClient } from '@prisma/client'
export const db = new PrismaClient()
// After (@mostajs/orm-bridge)
import { createPrismaLikeDb } from '@mostajs/orm-bridge'
export const db = await createPrismaLikeDb()
Your db.User.findMany({ include, orderBy, take }) keeps working. The bridge translates Prisma's API to our
dialect layer.
Or migrate an entire Prisma project in one command:
npx @mostajs/orm-cli bootstrap
This does: codemod + install deps + convert schema + create tables + optional data migration.
Cross-dialect replication
This is the feature nobody else has:
SQLite (dev) → PostgreSQL (prod) → MongoDB (analytics)
One config, live monitor dashboard, promoteToMaster failover in one CLI command. No Kafka, no infrastructure.
Data backup — 1 source → N destinations
npx mostajs-copy \
--source db --source-dialect postgres --source-uri "$PROD_URI" \
--dest db --dest-dialect sqlite --dest-uri ./backup.sqlite \
--dest sql-dump --dest-file ./backup.sql \
--dest json --dest-file ./backup.json \
--schemas entities.json --create-tables
Supports: DB → DB, DB → SQL dump, DB → CSV, DB → JSON, and reverse.
8 demo videos
I recorded the full workflow — from project init to live replication to Prisma migration. All videos are in the
GitHub README.
The ecosystem
┌──────────────────────────┬─────────────────────────────────────────────────────────────┐
│ Package │ What it does │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/orm │ Core ORM — 13 dialects │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/orm-bridge │ Prisma drop-in replacement │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/orm-cli │ Interactive CLI (convert, init, seed, replicate, bootstrap) │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/replicator │ Cross-dialect CDC replication │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/replica-monitor │ Live replication dashboard │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/orm-copy-data │ One-shot data copy & backup │
├──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ @mostajs/media │ Screen capture + video editor (ffmpeg.wasm) │
└──────────────────────────┴─────────────────────────────────────────────────────────────┘
Links
- GitHub: github.com/apolocine/mosta-orm
- npm: @mostajs/orm
Open source (AGPL-3.0) + commercial license available.
---
Built by a doctor who codes, in Algeria. Because government mandates don't care about your ORM's database
support list.
This article was originally published by DEV Community and written by MADANI.
Read original article on DEV Community