prisma-next init
Initialize Prisma Next files in a project.
prisma-next init scaffolds the Prisma Next config, contract source, and runtime files inside an existing project.
Use a Prisma Next quickstart when you want a complete new application template. Use prisma-next init when you already have a project and want to add the lower-level Prisma Next files.
Usage
prisma-next initRun it non-interactively:
prisma-next init --yes --target postgres --authoring pslOptions
| Option | What it does |
|---|---|
--target <db> | Sets the database target. Use postgres or mongodb. |
--authoring <style> | Sets the contract authoring style. Use psl or typescript. |
--schema-path <path> | Sets where the starter contract is written. |
--force | Overwrites an existing scaffold without prompting. |
--write-env | Writes .env from .env.example. |
--probe-db | Connects to DATABASE_URL once and checks the server version. |
--strict-probe | Treats a failed database probe as fatal. |
--no-install | Skips dependency installation and contract emission. |
What it creates
The exact files depend on the target and authoring style, but a Postgres PSL setup normally includes:
prisma-next.config.ts- a starter contract file such as
prisma/contract.prisma - emitted contract artifacts after installation runs
- a runtime client file that imports
contract.json - package scripts for contract emission and database commands
Examples
prisma-next init --yes --target postgres --authoring psl
prisma-next init --yes --target mongodb --authoring typescript --json
prisma-next init --no-installAfter initialization
Review the generated files, set DATABASE_URL, and emit the contract when you change the schema:
prisma-next contract emitThen initialize or verify the database:
prisma-next db init --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"