Prisma Next is in early access.Read the docs

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 init

Run it non-interactively:

prisma-next init --yes --target postgres --authoring psl

Options

OptionWhat 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.
--forceOverwrites an existing scaffold without prompting.
--write-envWrites .env from .env.example.
--probe-dbConnects to DATABASE_URL once and checks the server version.
--strict-probeTreats a failed database probe as fatal.
--no-installSkips 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-install

After initialization

Review the generated files, set DATABASE_URL, and emit the contract when you change the schema:

prisma-next contract emit

Then initialize or verify the database:

prisma-next db init --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"

On this page