contract.json and TypeScript types that serve as a stable, machine-readable contract between your schema and your queries.
Quickstart
Go from schema to your first type-safe query in minutes.
Installation
Install
prisma-next and the Postgres facade package.Core concepts
Understand the contract-first model that powers Prisma Next.
CLI reference
Full reference for every
prisma-next command.How it works
Prisma Next follows a three-step contract-first workflow:1
Define your schema
Write your data model in PSL (Prisma Schema Language) or TypeScript builders.
schema.psl
2
Emit the contract
Run
prisma-next contract emit to produce a deterministic contract.json and contract.d.ts. No executable code is generated — only data and types.3
Query with full type safety
Import the facade package and query using the SQL DSL or ORM client. The runtime verifies the contract hash against the database before any query runs.
db.ts
Key features
Contract-first design
Schema emits a deterministic
contract.json + TypeScript types. No generated runtime client — just data and types.Two query APIs
Fluent ORM client for model-level access and a composable SQL DSL for lower-level control. Both are fully type-safe.
Runtime verification
Cryptographic hash checks detect schema drift before any query runs, catching mismatches at startup.
Extension packs
Add pgvector, PostGIS, CipherStash, and more without touching core. Each pack contributes codecs, operations, and migration support.
Serverless-ready
Dedicated per-request facade for Cloudflare Workers, AWS Lambda, Vercel Edge, Deno Deploy, and Bun.
Migration system
Contract-to-contract migration graph with planner, runner, preflight verification, and multi-environment refs.