The starting point for every Prisma Next project is defining your data model. Prisma Next supports two authoring modes — Prisma Schema Language (PSL) and a TypeScript builder API — that both produce the same 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 artifact. Once emitted, that artifact drives query type safety, runtime verification, and migration planning without any further code generation.
Authoring modes
- PSL
- TypeScript
Prisma Schema Language uses a declarative, human-readable syntax. Models, fields, and relations are defined in a After authoring, run the emit command to produce the contract artifacts:
.psl file using familiar Prisma syntax.The emit command
prisma-next contract emit reads your contract source (PSL or TypeScript) and produces two artifacts in your output directory:
- Loads the contract source (bundles TypeScript with esbuild; validates import allowlist for TS mode)
- Validates that the resulting object is pure data — no functions, no getters, JSON-serializable
- Canonicalizes the contract (lexicographic key ordering, normalized scalars)
- Computes
storageHash,profileHash, and optionalexecutionHashvia SHA-256 over the canonical JSON - Writes
contract.jsonand generatescontract.d.ts
contract emit command does not connect to a database. You can run it without a driver configured.
What gets emitted
contract.json
The canonical JSON artifact contains everything needed to verify queries at runtime and plan migrations:contract.json by hand. The _generated warning header is there as a reminder.
contract.d.ts
The companion TypeScript declaration file exports branded types for every model and codec in your contract. Query DSL and ORM surfaces import from this file to give your queries fully-typed results:How contractHash is computed
Prisma Next uses SHA-256 over the canonicalized contract JSON to produce thestorageHash. Canonicalization rules include:
- All object keys sorted lexicographically at every nesting level
- Scalar values normalized (numbers, strings, booleans in standard forms)
- Default expressions normalized (e.g.
now()is always the same string) - Array ordering preserved where order is semantically meaningful
storageHash is stable across machines, operating systems, and Node.js versions. The runtime embeds this hash in every query plan and verifies it against the database marker before execution.
No-emit workflow
If you author your contract in TypeScript, you can skip the explicit emit step entirely during development. Types flow directly from the contract object through the DSL generics — no file needs to be written to disk.contract.json whenever the contract module changes. CI still runs prisma-next contract emit explicitly to validate determinism before deployment.
PSL-first and TypeScript-first authoring produce identical
storageHash values for the same schema. The canonical JSON representation is the same regardless of which authoring surface you use.