prisma-next-contract
Prisma Next — Contract Authoring
Edit your data contract. Prisma handles the rest.
The data contract is the single source of truth for your data layer. You edit a contract source — contract.prisma (PSL, the canonical surface) or contract.ts (TypeScript builder) — and the framework derives types, migrations, and runtime configuration from it. The three-step user model:
- You edit your data contract.
- The system plans the migrations for you. (
prisma-next-migrations) - If you need data migrations, you edit
migration.tsand execute it. (prisma-next-migrations)
Behind step 1 the agent runs prisma-next contract emit after every contract edit (or installs the Vite plugin so the bundler runs it on save — see prisma-next-build). Emit reads the contract source through the provider the façade picks based on the file extension of contract: in prisma-next.config.ts, then writes two artefacts colocated with the source:
contract.json— the canonical, content-hashed Contract IR. Read by the planner, the runtime, anddb verify.contract.d.ts— the precise TypeScript types the runtime + lanes propagate when you importContractfrom it.
Both files are emitted artefacts. Edit the source; never the JSON or .d.ts.