Chrome extension + Next.js dashboard for capturing dev session context and generating AI session reports.
- Docker Desktop is running — open it from the Start menu or tray.
- PostgreSQL container is up —
docker-compose up -dfrom repo root.- Verify:
docker ps→ should showworktrace-postgreswith statusUp. - If Prisma throws
upsert / queryerrors → DB is down, start Docker first.
- Verify:
- Dashboard dev server —
npm run devinside/dashboard(port 3000). - Extension points to localhost —
extension/.envhasVITE_DASHBOARD_URL=http://localhost:3000.- After any
.envchange → rebuild:npm run buildinside/extension.
- After any
Symptom guide
ERR_CONNECTION_REFUSEDon fetch → dashboard not running or wrong URLInvalid prisma.X() invocation/Can't reach database→ Docker / PostgreSQL not running- Extension shows
⚠ JWT exchange failed→ dashboard not reachable (check steps 2–3 above)
/dashboard— Next.js 16 (App Router) web app/extension— Chrome Extension (Manifest V3) — coming in AC 4/docs— task spec- Database: PostgreSQL via Prisma 7
- TypeScript strict.
anyis forbidden — useunknown+ type guards, or define proper types.
- Business logic lives in
dashboard/server/(server-only modules). - Route Handlers in
dashboard/app/api/**/route.tsare thin: parse → validate (Zod) → callserver/→ respond. - React components NEVER contain business logic or direct DB access.
- Server Components MAY call
server/modules directly (no fetch round-trip).
Auth logic lives ONLY in:
dashboard/app/api/auth/**/route.ts— Google token verification, JWT issuancedashboard/proxy.ts— route guarding for/dashboard/*
Do NOT duplicate auth checks in components, server modules, or other Route Handlers.
- NEVER import from
dashboard/insideextension/(or vice versa). - All extension API calls go through
background.ts(service worker) — never directly fromcontent.tsorpopup.ts. - JWT lives in
chrome.storage.local, read/written only by service worker.
- Schema:
dashboard/prisma/schema.prisma. - Two generators run on
prisma generate:dashboard/generated/prisma/— Prisma client (entry:client.ts)dashboard/generated/zod/— Zod schemas (prisma-zod-generator)
- Both folders gitignored.
- Imports:
import { PrismaClient } from "@/generated/prisma/client"— not@prisma/client(Prisma 7 usesclient.tsentry).- Base Zod schemas:
import { EventUncheckedCreateInputObjectZodSchema } from "@/generated/zod/schemas/objects/EventUncheckedCreateInput.schema".
- Singleton
PrismaClientper process — seedashboard/server/db.ts. Uses@prisma/adapter-pg(Prisma 7 requires a driver adapter at runtime). - Migrations are committed to git.
- Zod for all external input (Route Handlers, extension messages, env vars).
- API-facing schemas live in
dashboard/server/schemas/<domain>.ts— derived from the generated@/generated/zodbase schemas via.omit()/.extend()/.pick(). Never hand-write a schema that duplicates Prisma model fields. - Validate at the boundary, not deep inside business logic.
Task-specific recipes live in .claude/skills/:
api-route.md— adding a Next.js Route Handlerprisma-model.md— adding/changing a Prisma modelextension-message.md— messaging between extension contexts
Use Plan → Review → Implement for non-trivial work:
- Write a plan markdown to
/plans/<name>.mddescribing scope and decisions - User reviews and approves
- Implement following the approved plan