Repository Guidelines
Project Structure & Module Organization
app/holds the Next.js route tree, including route handlers and shared layouts; use the@/alias for imports.- UI primitives live in
components/and supporting hooks, utilities, and types reside inhooks/,lib/, andtypes/. - Backend integrations (Prisma client, auth helpers) live under
prisma/andauth.ts; seed data is inseed_*.json. - Automated tests are split between
tests/(unit/integration with Vitest) ande2e/(Playwright specs). Visual artifacts land inplaywright-report/. - Infrastructure and tooling assets live in
scripts/,k8s/,terraform/, anddocs/;ml-service/houses the auxiliary ML worker.
Build, Test, and Development Commands
pnpm devlaunches the Turbopack dev server with.env.localsecrets.pnpm buildcompiles the Next.js app;pnpm startserves the production build using.env.production.pnpm lint,pnpm format:check, andpnpm circularcover linting, Prettier verification, and dependency cycle scans.pnpm prisma:migrate+pnpm prisma:deploymanage schema changes;pnpm seedhydrates a local database.pnpm test,pnpm test:watch, andpnpm test:e2erun Vitest and Playwright suites (headed/DEBUG variants available for troubleshooting).
Coding Style & Naming Conventions
- TypeScript is mandatory; follow module-aliased imports (
@/components/...) and prefer React Server Components when possible. - Prettier (3.x) and Next ESLint (9) enforce 2-space indentation, single quotes, and Tailwind class ordering—run
pnpm formatbefore large diffs. - Use PascalCase for React components, camelCase for functions/variables, SCREAMING_SNAKE_CASE for constants, and hyphenated filenames for routes.
- Tailwind utility-first styling is standard; compose complex styles with
clsxorclass-variance-authority.
Testing Guidelines
- Place Vitest specs alongside code in
tests/using the<name>.test.tspattern; prefer descriptivedescribeblocks for feature scopes. - Ensure new features ship with Vitest coverage or Playwright journeys when user flows change. Snapshot tests belong in Vitest, not Playwright.
- For database-dependent tests, load fixtures through Prisma seed helpers and reset state in
beforeEachvia the provided utilities.
Commit & Pull Request Guidelines
- Follow Conventional Commits (
feat(scope): summary,fix:,refactor(k8s):, etc.); keep subject ≤72 characters. - Squash noisy work-in-progress commits locally; retain meaningful history for review.
- Pull requests must describe the change, link tracking issues, include test evidence (
pnpm test/pnpm test:e2eoutput), and attach UI screenshots when altering theapp/surfaces. - Tag owners of affected areas (
app/,ml-service/,k8s/) and highlight any migration or seed steps in the checklist.