ormDB

ormDB + Prisma

Language: typescriptPackage: @ormdb/prisma-adapterStatus: beta

What This Adapter Does

ormDB is a relational database engine written in Rust that replaces PostgreSQL, MySQL, and SQLite as the actual database underneath your application. The @ormdb/prisma-adapter package connects Prisma’s query engine to ormDB, so you keep your existing Prisma schema, models, and application code while gaining ormDB’s native graph-fetch queries, zero-copy wire protocol, and built-in capabilities like vector search and change streams.

Prisma already thinks in terms of object graphs. When you write findMany with nested include blocks, Prisma understands you want related data. The problem is that traditional SQL databases force Prisma to decompose that intent into multiple sequential queries, creating the N+1 problem. ormDB understands the graph natively, resolving your entire include tree in a single round-trip via graph-fetch queries.

Quick Setup

Install the adapter alongside your existing Prisma setup:

npm install @ormdb/prisma-adapter

Update your Prisma schema datasource:

datasource db {
  provider = "ormdb"
  url      = env("ORMDB_URL")
}

Initialize the adapter in your application:

import { PrismaClient } from '@prisma/client'
import { withOrmDB } from '@ormdb/prisma-adapter'

const prisma = withOrmDB(new PrismaClient())

// Your existing queries work unchanged
const users = await prisma.user.findMany({
  include: {
    posts: {
      include: {
        comments: true,
        tags: true,
      },
    },
  },
})

What Changes, What Stays the Same

Stays the same: Your Prisma schema, model definitions, relation declarations, all findMany/findUnique/create/update/delete operations, and nested include/select queries.

Changes: The database underneath. Instead of PostgreSQL issuing multiple SQL queries to resolve nested includes, ormDB fetches the entire object graph in one round-trip. Migrations gain A-D safety grading. You get built-in vector search, geo search, full-text search, and change streams without extensions.

Removed: Raw SQL queries ($queryRaw, $executeRaw) are not available because ormDB does not speak SQL. If your application relies on raw SQL, those specific calls need to be refactored into Prisma’s type-safe query API. See best database for Prisma users for a deeper comparison of database options for Prisma.

Frequently Asked Questions

Do I need to rewrite my Prisma schema to use ormDB?

No. Your existing Prisma schema works as-is. The adapter translates Prisma's query engine calls into ormDB's native entity/relation protocol. Your models, relations, and migrations all carry over.

Does Prisma's include and select still work?

Yes. Prisma's include and select map directly to ormDB's graph-fetch queries. The difference is that ormDB resolves the entire nested include in a single round-trip instead of issuing multiple SQL queries.

Can I use Prisma Migrate with ormDB?

The adapter intercepts Prisma Migrate commands and routes them through ormDB's migration engine, which grades each migration from A (safe) to D (destructive). You get the same workflow with stronger safety guarantees.

What Prisma features are not yet supported?

Raw SQL queries ($queryRaw, $executeRaw) are not supported because ormDB does not use SQL. Interactive transactions, relation filters, and all standard CRUD operations are fully supported.

Is the adapter production-ready?

The adapter is in beta. ormDB itself is in Alpha v0.1.0. The adapter is suitable for development and testing, with production readiness expected as ormDB reaches stable releases.

Related Content

Try ormDB today

Open source, MIT licensed. Install and start building.