CLI configuration
Configure Prisma Next CLI commands with prisma-next.config.ts and global flags.
Prisma Next CLI commands use prisma-next.config.ts as the project entrypoint for contract emission, database operations, and migrations.
Config file
Commands that need project context read the Prisma Next config from your project. For PostgreSQL projects, use the Postgres config helper:
import "dotenv/config";
import { defineConfig } from "@prisma-next/postgres/config";
export default defineConfig({
contract: "./prisma/contract.prisma",
db: {
connection: process.env["DATABASE_URL"]!,
},
});For MongoDB projects, import defineConfig from @prisma-next/mongo/config instead.
Pass --config when your config file is not in the default project location:
prisma-next contract emit --config ./config/prisma-next.config.tsEmit-only config
contract emit does not connect to a database, so the config can omit db.connection:
import { defineConfig } from "@prisma-next/postgres/config";
export default defineConfig({
contract: "./prisma/contract.prisma",
});Add db.connection before running commands such as db verify, db sign, db init, db update, db schema, contract infer, or migration apply.
Extension packs
Add extension control descriptors to the config when your contract uses extension-provided types:
import { defineConfig } from "@prisma-next/postgres/config";
import pgvector from "@prisma-next/extension-pgvector/control";
export default defineConfig({
contract: "./prisma/contract.prisma",
extensions: [pgvector],
db: {
connection: process.env["DATABASE_URL"]!,
},
});Re-run prisma-next contract emit after changing extension packs, then update the matching runtime client.
Database URLs
Database commands accept --db <url>. If you omit it, Prisma Next can use the database connection from prisma-next.config.ts.
prisma-next db verify --db "$DATABASE_URL"Environment variables
| Variable | What it does |
|---|---|
DATABASE_URL | Common place to store the database connection string used by config files and scripts. |
NO_COLOR=1 | Disables colored terminal output. |
Output modes
Use the default text output when running commands locally. Use --json in CI or automation:
prisma-next db verify --db "$DATABASE_URL" --jsonUse --no-interactive for scripts that must never pause for user input.