PostgreSQL
Create a new Prisma 8 project with PostgreSQL using create-prisma@latest.
Create a Prisma 8 app with PostgreSQL and run your first query against seeded data.
Prisma 8 is the current release of Prisma ORM. Prisma 7 remains fully supported; its docs live at /orm/v7 and its setup paths at /v7/getting-started.
Quick start
bunx create-prisma@latest --provider postgresRun this from a Node.js 24 or newer environment. The command preselects PostgreSQL and prompts you for the contract authoring style (PSL or TypeScript) and your package manager.
Setup gives you the app template, a starter contract, prisma-next.md, project-level Prisma 8 skills for your coding agent, and package scripts for the database steps below. Sample users are seeded automatically the first time the app queries the database, so there is no separate seed step.
From here you have two paths: let Prisma Composer run a local Prisma Postgres database for you, or connect a PostgreSQL database you provide.
Path A: Run with a local database
Composer builds the app, starts a local Prisma Postgres database, and applies the starter contract for you, so you do not need a connection string.
bun run dev:composerOpen the URL the command prints. You should see the seeded users returned from PostgreSQL.
Path B: Connect your own database
1. Set the database connection
Export DATABASE_URL in the shell you run the commands from. The generated scripts read the variable from the environment, not from .env.
export DATABASE_URL="postgresql://username:password@host:5432/database?sslmode=require"If you don't have a PostgreSQL database yet, npx create-db@latest creates a temporary Prisma Postgres database and prints its connection string, plus a claim URL if you want to keep it.
2. Initialize the database
From the generated project directory, run db:init to apply the starter contract to PostgreSQL and sign the database.
bun run db:initThe output ends with a summary like Applied 5 operation(s) across 1 space(s), database signed.
3. Run the app
Start the app and confirm the sample query runs successfully.
bun run devUse the URL or terminal output shown by your template. You should see the seeded users returned from PostgreSQL. If the response is Could not query users yet, DATABASE_URL is not set in the environment the app runs in; export it in the same shell and restart.
Next steps
- Open
src/prisma/contract.prismaorsrc/prisma/contract.tsand change the starter model. - Use the PostgreSQL existing-project guide if you already have an app and database.
- Read the Prisma 8 overview when you want the concepts behind contracts, query APIs, and migrations.
