Documentation 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.
prisma-next contract emit reads your TypeScript-authored contract from config.contract, validates its purity, and writes two canonical artifacts to disk: contract.json (the serialized contract with metadata) and contract.d.ts (the corresponding TypeScript type declarations). No database connection is required — this command is fully offline.
Synopsis
Options
Path to
prisma-next.config.ts. Accepts relative or absolute paths. Defaults to ./prisma-next.config.ts in the current working directory if the file is present. The CLI does not search upward.Emit a JSON result envelope to stdout instead of the default human-readable TTY output. Use this flag in build pipelines and editor integrations.
Suppress all output except errors.
Print debug information and timing data.
Print deep internal trace output including stack traces. Intended for debugging the CLI itself.
Force-enable or force-disable ANSI color in output. By default, color is enabled when stdout is a TTY.
Config file requirements
contract emit does not connect to a database, so a driver is not required in your config. The minimum required fields are family, target, adapter, and contract.
prisma-next.config.ts
The second argument to
typescriptContract sets contract.output — the path where contract.json is written. contract.d.ts is always co-located with contract.json. If omitted, contract.output defaults to src/prisma/contract.json.Examples
Output format
TTY (default)
When stdout is a TTY, the command prints a human-readable summary:JSON (--json)
With --json, the command prints a single JSON object and exits:
Emitted artifacts
contract.json
A JSON serialization of the canonicalized contract. The file includes a _generated metadata field indicating it is a generated artifact and must not be edited manually. The _generated field is excluded from canonicalization and hashing so it does not affect storageHash or profileHash.
contract.d.ts
TypeScript type declarations derived from contract.json. The file opens with a warning header comment marking it as generated. Import from this file to get precise literal types for use with validateContract<Contract>(json) — JSON imports alone lose literal types.
Canonical emit path
Both this CLI command and the@prisma-next/vite-plugin-contract-emit Vite plugin route through the same executeContractEmit function. If you need to extend emission behavior, extend ContractEmitOptions / ContractEmitResult and update executeContractEmit directly — do not re-implement the load → emit → publish flow in a new caller.