Files
boat/DEVELOPMENT.md
Maxime Van Hees 4d024a39f4 first MVP
2025-11-14 21:07:10 +01:00

5.6 KiB
Raw Permalink Blame History

Boat — Local Development Runbook

This runbook explains how to run the Boat MVP locally, seed demo data, and troubleshoot common issues.

Project layout highlights

Prerequisites

  • Docker (to run local Postgres quickly)
  • Node 20+ and npm
  1. Start Postgres (Docker) If you havent yet started the Docker Postgres container, run:
  • docker volume create boat-pgdata
  • docker run -d --name boat-postgres -p 5432:5432 -e POSTGRES_DB=boat -e POSTGRES_USER=boat -e POSTGRES_PASSWORD=boat -v boat-pgdata:/var/lib/postgresql/data postgres:16

Verify its running:

  • docker ps | grep boat-postgres
  1. Environment variables This repo already includes .env pointing to the Docker Postgres: DATABASE_URL="postgresql://boat:boat@localhost:5432/boat?schema=public"

  2. Install deps and generate Prisma Client From the app directory:

  • npm install
  • npx prisma generate
  1. Migrate the database
  • npx prisma migrate dev --name init
  • npx prisma migrate dev (if new migrations were added)

Note: Constraints for undirected uniqueness and self-edges are included in prisma.migration.sql.

  1. Seed demo data (20 people)
  • npm run db:seed

This executes prisma.seed() and inserts people and connections.

  1. Run the Next.js dev server Important: run from the app directory, not workspace root.
  • npm run dev

Access:

  1. Using the app
  1. API quick tests

Troubleshooting

A) “npm enoent Could not read package.json at /home/maxime/boat/package.json”

  • You ran npm in the workspace root. Use the app directory:
    • cd boat-web
    • npm run dev

B) “Unable to acquire lock … .next/dev/lock”

  • Another Next dev instance is running or a stale lock exists.
    • Kill dev: pkill -f "next dev" (Unix)
    • Remove lock: rm -f .next/dev/lock
    • Then: npm run dev

C) “Failed to load external module @prisma/client … cannot find module '.prisma/client/default'”

  • Prisma client must be generated after schema changes or misconfigured generator.
    • Ensure generator in prisma.schema() is: generator client { provider = "prisma-client-js" }
    • Regenerate: npx prisma generate
    • If still failing, remove stale output and regenerate:
      • rm -rf node_modules/.prisma
      • npx prisma generate

D) Port 3000 already in use

  • Run on a different port:
    • npm run dev -- -p 3001

Tech notes

  • The undirected edge uniqueness is enforced via functional unique index on LEAST/GREATEST and a no-self-edge CHECK in prisma.migration.sql.
  • Deleting a person cascades to connections (MVP behavior).
  • Sectors, interests, and eventLabels are free-text arrays (TEXT[]).
  • Introduced-by chain is an ordered list of person IDs (existing people only).
  • UI intentionally minimal and open as per MVP brief.

Acceptance checklist mapping