Prisma Next is a ground-up TypeScript rewrite of Prisma ORM, built around a contract-first model. Instead of generating an opaque runtime client, Prisma Next emits a deterministicDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/prisma/prisma-next/llms.txt
Use this file to discover all available pages before exploring further.
contract.json and TypeScript types that describe your database schema. These artifacts become the single source of truth for query authoring, runtime verification, and tooling — including AI-assisted workflows.
The problem Prisma Next solves
Traditional ORMs — including Prisma ORM — generate an executable runtime client from your schema. That client is opaque, hard to diff, and tightly coupled to the schema at generation time. Detecting drift between the generated client and the live database requires running queries; there is no lightweight way to verify the two are in sync. Prisma Next separates concerns: schema authoring produces a data contract (JSON + TypeScript types), and query execution is handled by a composable DSL that is verified against that contract at runtime. The contract is a plain JSON file — diffable, hashable, and readable by humans and machines alike.How Prisma Next differs from Prisma 7
| Feature | Prisma ORM (v7) | Prisma Next |
|---|---|---|
| Schema model | Codegen for runtime client | Contract IR + TypeScript types |
| Code generation | Heavy, runtime-bound | Minimal, build-time only |
| Query interface | Generated methods | Composable DSL |
| Machine readability | Opaque client code | Structured IR JSON |
| Verification | None | Contract hash + runtime checks |
| Extensibility | Monolithic client | Plugin and hook system |
| Migration logic | Sequential scripts | Contract-based, deterministic |
- Write
schema.prisma - Run
prisma generate— generates executable client code - Call generated methods:
prisma.user.findMany()
- Write
schema.psl - Run
prisma-next contract emit— generates lightweight types + contract JSON - Query using the composable DSL:
db.sql.user.select(...).build()
The three-step contract-first workflow
Every Prisma Next project follows the same three steps.Define your schema
Write your data model in PSL (Prisma Schema Language). The schema is the authoritative description of your database structure.
schema.psl
Emit the contract
Run The contract includes a
prisma-next contract emit to produce a deterministic contract.json and contract.d.ts. No executable code is generated — only data and types.contractHash that cryptographically ties all artifacts to a specific schema version. The runtime uses this hash to detect drift before any query runs.Two query APIs
Prisma Next ships two query APIs that share the same contract and type system.db.sql — SQL DSL: A composable, type-safe query plan builder that gives you precise control over what SQL is generated. Queries are built as explicit plan objects that can be inspected, logged, and verified before execution.
db.orm — ORM client: A fluent model-level API with where, include, select, and orderBy composition. Results are fully typed based on your contract. The ORM client builds on the same plan infrastructure as the SQL DSL, so it inherits all runtime verification guarantees.
Extensible by design
Prisma Next supports extension packs — optional packages that add new schema attributes, query operators, codecs, and migration support. Extension packs are registered inprisma-next.config.ts:
prisma-next.config.ts
What’s next
Quickstart
Go from schema to your first type-safe query in minutes.
Installation
Install the CLI and Postgres facade package step by step.
Core concepts
Deep dive into the contract-first model, schema emission, and runtime verification.
CLI reference
Full reference for every
prisma-next command.