1.0.2 Prisma + Postgres setup (local Docker), placeholder schema, first migration
Estimate: 10m · Depends on: 1.0.1
Wire up Prisma as the ORM and a local-Docker Postgres as the dev database. Create the initial schema.prisma with no user tables yet — just enough to prove the connection works and migrations apply. Real schema (user, workspace, work_item) arrives in subsequent stories (1.1.3, 1.2.1, 1.4.2).
Why local Postgres in Docker (not SQLite or a hosted dev DB): production uses Postgres, so dev should match. SQLite has too many subtle differences (no native JSON ops, weaker type system, no RLS for 1.2.1). A hosted dev DB adds a network hop and a credential dance for every contributor. Docker is the smallest, most-portable way to give every developer the right database locally.
What you'll do: Add prisma and @prisma/client deps. Create /prisma/schema.prisma with a Postgres datasource pointing at env("DATABASE_URL"). Add a docker-compose.yml with a single Postgres 16 service. Write a scripts/db-up.sh that brings the DB up and applies migrations. Add a placeholder migration (no app tables yet — just so the migration system is exercised). Add /lib/db.ts exporting a singleton PrismaClient following the Next.js dev-mode pattern (avoid hot-reload connection leaks).
Acceptance criteria
prismaand@prisma/clientinstalled./prisma/schema.prismaexists with a Postgres datasource pointing atenv("DATABASE_URL").docker-compose.ymldefines a single Postgres 16 service with a named volume for persistence.scripts/db-up.shbrings up the DB and runsprisma migrate deploy; exits 0 on success.- A placeholder migration exists under
/prisma/migrations/(it can be empty or create a no-op marker table). /lib/db.tsexports a singletonPrismaClientwith the Next.js dev-mode hot-reload guard..env.exampleupdated withDATABASE_URL="postgresql://prodect:prodect@localhost:5432/prodect"and a comment explaining the dev pattern.pnpm prisma migrate devsucceeds against the Docker DB.
Context refs
- Prisma docs for Postgres + Next.js (singleton pattern)
README.md(after 1.0.4) — to extend with the DB section.env.example(from 1.0.1) — to addDATABASE_URL- Postgres 16 Docker image docs