# Copilot instructions This repository is a Next.js app with a Postgres database. It uses TypeScript, React Server Components and Tailwind CSS. Packages are managed with pnpm. ## Build and test - Install: `pnpm install --frozen-lockfile` - Start the database: `docker compose up -d --wait` - Run the app: `pnpm dev`, then open `http://localhost:3000` - Before you finish, run `pnpm lint`, `pnpm typecheck` and `pnpm test`. All three must pass. ## Project layout - `app/` holds routes. A folder is a URL segment, and `page.tsx` renders it. - `components/ui/` holds shared components. Use them before writing new markup. - `lib/db/` holds the schema and queries. Every query goes through these functions. - `lib/db/migrations/` holds SQL migrations. Never edit one that has been merged. ## Code style - Write server components by default. Add `"use client"` only for state, effects or browser APIs. - Validate every request body and form input with the Zod schemas in `lib/validation`. - Name files in kebab-case and components in PascalCase. - Use Tailwind classes and theme tokens. Do not write hex colors in components. ## Testing - Put a test next to the code it covers, as `name.test.ts`. - Test behavior through public functions, not private helpers. - A bug fix starts with a test that fails without the fix. ## Pull requests - Keep one change per pull request, and describe what changed and how you checked it. - Do not add dependencies without saying why in the pull request description. - Never commit secrets. Configuration comes from environment variables listed in `.env.example`.