Skip to content

Conversation

anettkva
Copy link
Member

Summary

Sets up the backend as its own package with Prisma and PostgreSQL. The database models come in the next issue.

Changes

  • backend/ is now an npm workspace, so npm ci from the root installs both frontend and backend
  • Prisma 7 with PostgreSQL: only the connection and the client generator for now, no models yet
  • backend/.env.example shows how to write DATABASE_URL. Your own backend/.env is not committed
  • New npm scripts: db:generate, db:migrate, db:deploy and db:studio
  • ESLint now also checks the backend, with Node rules
  • README: why Prisma, and a new "Database (local setup)" section for installing PostgreSQL 18 on Mac and Windows
  • AI usage documented in docs/AI_USAGE.md

How to test

  1. Install PostgreSQL 18 and create the cop user and database, as described in "Database (local setup)" in the README
  2. Copy backend/.env.example to backend/.env and fill in your password
  3. Run npm ci from the root
  4. Run npx prisma migrate status in backend/. If the output shows Datasource "db": PostgreSQL database "cop" ... at "localhost:5432", the connection works. "No migration found" and "not managed by Prisma Migrate" are expected on a fresh setup, because there are no tables or migrations until the next issue.

Good to know

  • Everyone should install PostgreSQL 18, so that migrations work the same for all of us.
  • Prisma is pinned to 7.10.0. npm's "latest" tag for Prisma currently points to a test release.
  • Prettier flags backend/src/schema.graphql, but it is not changed in this PR. The file already failed the Prettier check before this branch, and this PR was not meant to touch the schema. We should decide when to format it: in its own small PR, or together with the next issue that changes the schema.

Closes #21

🤖 Generated with Claude Code

@anettkva anettkva requested a review from a team as a code owner October 14, 2026 12:54
@anettkva anettkva merged commit 5987cef into dev Oct 15, 2026
@anettkva anettkva deleted the 21-set-up-the-backend-and-prisma branch October 15, 2026 06:34
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant