Discord | X | Blog Post | Architecture
In Development (Pre-1.0): Prisma Next is an active engineering project and a public look at where Prisma is heading. It is not ready for production yet — pre-1.0, expect breaking changes between minor versions, and only the latest minor receives security fixes. Don't build production applications on Prisma Next yet unless you are prepared to follow upgrades closely.
Prisma 7 remains the recommended version of Prisma for production applications.
Prisma Next is a new foundation for Prisma ORM, rewritten fully in TypeScript to be extensible and composable by default. Read the full announcement: The Next Evolution of Prisma ORM.
- A TypeScript rewrite of Prisma ORM: Rebuilt end-to-end to unlock new capabilities and a more composable architecture.
- Extensible by default: Add extension packs in
prisma-next.config.tsto unlock new schema attributes and new query capabilities. - Two query APIs:
- ORM Client (
db.orm): model collections with fluentwhere/include/selectcomposition - Query builder (
db.sql): type-safe SQL plan builder for when you want lower-level control
- ORM Client (
- Designed for AI-assisted workflows: deterministic contracts, structured plans, stable diagnostics, and guardrails that help agents (and humans) iterate safely.
Your schema becomes a verifiable contract: a deterministic artifact (contract.json + TypeScript types) that describes which models, tables, and fields exist.
- Verify at runtime: detect schema drift before a query runs
- Type your queries: keep results and query operators fully type-safe
- Power tooling + agents: contracts, plans, and diagnostics are structured data — easy to inspect, diff, and reason about
Queries remain readable and composable as they grow, with fully-typed autocompletion:
const orders = await db.orders
.where({ userId: currentUserId })
.where((o) => o.status.in(['shipped', 'delivered']))
.include('shippingAddress')
.include('items', (item) =>
item.include('product', (product) =>
product
.include('category')
.include('images', (img) => img.where({ isPrimary: true }).take(1))
.include('reviews', (reviews) =>
reviews
.where((r) => r.rating.gte(4))
.orderBy((r) => r.createdAt.desc())
.take(3)
.include('author', (a) => a.select('name', 'avatar')),
),
),
)
.all()Every operation produces structured output that machines can understand. Compile-time guardrails catch mistakes before runtime, and machine-readable errors include stable codes and suggested fixes:
// Type error: update() requires where()
await db.users.update({ active: false }){
"code": "CAPABILITY_REQUIRED",
"message": "updateAll() requires 'returning' capability",
"fix": "Add 'returning' to contract capabilities or use updateCount()"
}1. Define your schema:
// schema.psl
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
}2. Emit the contract:
prisma-next contract emit schema.psl -o .prisma
# Generates: .prisma/contract.json + .prisma/contract.d.ts3. Query with full type safety:
import postgres from '@prisma-next/postgres/runtime'
import type { Contract } from './.prisma/contract.d'
import contractJson from './.prisma/contract.json' with { type: 'json' }
const db = postgres<Contract>({
contractJson,
url: process.env['DATABASE_URL']!,
})
const users = await db.orm.users
.select('id', 'email')
.take(10)
.all()
// users: Array<{ id: number; email: string }>Add an extension pack in prisma-next.config.ts to unlock new schema attributes and query operators. For example, pgvector:
// prisma-next.config.ts
import { defineConfig } from '@prisma-next/cli/config-types'
import pgvector from '@prisma-next/extension-pgvector/control'
export default defineConfig({
// ...
extensionPacks: [pgvector],
})model Document {
id Int @id
title String
embedding Bytes @pgvector.column(length: 1536)
}await posts
.where(p => p.embedding.cosineDistance(searchParam).lt(0.2))
.all()- Node.js 24 LTS (or newer)
- pnpm
- PostgreSQL
git clone https://github.com/prisma/prisma-next.git
cd prisma-next
pnpm install && pnpm build
cd examples/prisma-next-demo
# Create .env with your DATABASE_URL, then:
pnpm emit && pnpm seed && pnpm startOr check out the Pokedex example app for a more complete example.
Prisma Next follows a three-step contract-first workflow:
- Define your schema in PSL (Prisma Schema Language)
- Emit a deterministic contract (JSON) and TypeScript types: no executable code generated
- Query using either
db.orm(ORM Client) ordb.sql(query builder), verified against the contract
The contract is the single source of truth. It's diffable, hashable, and machine-readable.
For architecture details, see ARCHITECTURE.md.
Prisma Next is in development. Here's what to expect:
| Area | Status |
|---|---|
| Schema definition (PSL) | Working* |
| Contract emission | Working* |
| SQL query DSL | Working* |
| ORM-style queries | Working* |
| Postgres adapter | Working* |
| Plugin system | Working* |
| Migrations | Minimal |
| MySQL / SQLite | Not yet |
(*) Working, but not feature-complete or production-ready. APIs are subject to breaking changes.
Contributions are welcome. See CONTRIBUTING.md for setup, the test/lint/typecheck command set, DCO signoff, and PR expectations. For substantive changes please open an issue first so we can give you direction-fit feedback before you invest implementation time.
Security issues should not be filed as public issues — please follow the Private Vulnerability Reporting flow described in SECURITY.md.
- Discord: Join the conversation at pris.ly/discord
- X: Follow @prisma for updates
- Blog: Read about our journey at prisma.io/blog
Prisma Next is licensed under Apache 2.0.