FORM FOLLOWS DOMAIN. DOMAIN COMES FIRST.NODE.JS / REACT
CONTRACT → DATABASE → PRISMA

PREPARE
PERSISTENCE.

@domain-first/project-structure

Set up the Project Structure PostgreSQL preset for Prisma 8 RC: a starter contract, configuration, optional shared service and migration scripts.

01PostgreSQL contract setup
02Optional wired Prisma service
03Explicit migration commands
01 / ENABLE

Choose the PostgreSQL preset.

Terminal
npx df-ps

Select Add integration → Prisma 8 (PostgreSQL, RC). Choose whether to generate the shared Prisma infrastructure service and whether prisma should become your default persistence implementation label.

PRESET SCOPE

This preset targets Prisma 8 RC with PostgreSQL. It is not a Prisma 7 migration tool. The scaffolder prepares files and scripts; it does not connect to the database.

02 / OUTPUT

Keep database setup in Infrastructure.

Generated filesExample with rootFolder: src
src/shared/infrastructure/prisma/
  prisma.config.ts
  contract.prisma

Optional:
src/shared/infrastructure/services/
  ... PrismaInfrastructureService
src/shared/wiring/
  ... service factory when wire is enabled

Existing contracts and models are preserved. The optional service exposes orm, uses the Temporal polyfill and reuses its client across development hot reloads. With wire enabled, a factory is generated too.

Package scripts point at the generated Prisma config. Existing script conflicts can be kept, replaced or renamed. Install the missing dependencies printed by the CLI; existing declared dependencies are preserved.

03 / CONFIGURE

Add the connection and models.

Configure DATABASE_URL, add models to contract.prisma and run emit before compiling or importing the generated service. The CLI loads .env; your application must load its own runtime environment. Add the printed exception for the Prisma directory to your linter ignores.

The documented preset expects Node.js 22.18+, TypeScript 5.9+, ESM and JSON import support. Review compatibility with the dependencies selected in your project.

04 / MIGRATIONS

Emit. Plan. Review. Apply.

Terminal
npm run prisma:emit
Terminal
npm run prisma:migration:plan

Review the planned migration before applying it.

Terminal
npm run prisma:migration:apply

Emit produces the contract artifacts; plan emits the contract and plans a migration; apply applies migrations and advances the db reference. Prisma manages generated contract files and migration history.

Repository and execution-handler skeletons still need your actual persistence behavior. See Building blocks ↗.