Skip to main content
Prisma Next is distributed as two separate npm packages: the prisma-next CLI (a dev dependency used at build time) and a target facade such as @prisma-next/postgres (a runtime dependency). This page covers prerequisites, both installation paths, and how to configure the project manually if you prefer not to use the prisma-next init scaffold.

Prerequisites

Before installing, make sure your environment meets these requirements:
  • Node.js 24 LTS or newer. Prisma Next uses import ... with { type: 'json' } (JSON import attributes) and other Node.js 24 features.
  • pnpm (recommended) or npm, yarn, or bun. The CLI and all examples use pnpm.
  • PostgreSQL — a running Postgres instance accessible via a DATABASE_URL connection string. MongoDB support is available via @prisma-next/mongo (see below).

Install the CLI

Install prisma-next as a dev dependency. It provides the prisma-next binary used to emit contracts, manage the database, and run migrations.
Confirm the install worked:

Install the target facade

Install @prisma-next/postgres as a regular (runtime) dependency. This single package includes the config helper, the Node.js runtime facade, the serverless facade, and all transitive type dependencies — you do not need to install adapter or driver packages separately.

Automated scaffold with prisma-next init

Run pnpm dlx prisma-next init to scaffold an entire project in one step. The init command prompts for your database target (PostgreSQL or MongoDB), your schema location, and your connection string. It then installs prisma-next and the appropriate facade, creates prisma-next.config.ts and a starter schema, and runs prisma-next contract emit automatically.
You can also run init without installing the CLI first:

Manual setup

If you prefer to configure the project yourself, follow these steps.

Create prisma-next.config.ts

Create prisma-next.config.ts at the root of your project. Use the defineConfig export from @prisma-next/postgres/config, which pre-wires the Postgres family, target, adapter, and driver — you only need to supply the schema path and connection options.
prisma-next.config.ts
Store your database URL in a .env file:
.env

Extension packs

To add an extension pack such as pgvector, install its package and register it in the config:
prisma-next.config.ts
When using @prisma-next/postgres/config’s simplified defineConfig, the option is named extensions. When using the full @prisma-next/cli/config-types defineConfig directly, the option is named extensionPacks.

Add a DATABASE_URL to your environment

The connection string follows the standard Postgres URI format:
For local development, a typical value is:

Emit the contract and initialize the database

With the config and schema in place, emit the contract and bootstrap the database:
contract emit writes contract.json and contract.d.ts to the output path set in your config. db init creates the tables described by the contract (additive only — existing tables are not modified).

MongoDB alternative

If you are targeting MongoDB instead of PostgreSQL, install @prisma-next/mongo in place of @prisma-next/postgres and use its defineConfig export:
prisma-next.config.ts
The rest of the workflow — emit, db init, queries — is identical. Refer to the MongoDB guide for target-specific differences.

Verify your installation

After setup, confirm everything is working:
If db verify exits cleanly, your environment is correctly set up and you are ready to write queries.

Next steps

Quickstart

Walk through the full workflow: schema, emit, db init, and first query.

CLI reference

Full reference for every prisma-next command and flag.

CLI configuration

Full reference for every option in prisma-next.config.ts.

Core concepts

Understand the contract-first model that powers Prisma Next.