<One sentence: what the app does and who uses it.>
Stack
- Next.js (App Router) + React + TypeScript (strict)
-
Styling: <Tailwind CSS CSS Modules> -
Data: <Postgres via Prisma Drizzle Supabase>; auth: <Auth.js Clerk custom> -
Package manager: <pnpm npm bun> (do not mix lockfiles)
Commands
- Dev:
<pnpm> dev(http://localhost:3000) - Typecheck:
<pnpm> tsc --noEmit - Lint:
<pnpm> lint - Unit tests:
<pnpm> vitest run(one file:<pnpm> vitest run path/to/file.test.ts) - E2E:
<pnpm> playwright test(needs the dev server orwebServerconfig) - Production build:
<pnpm> build(run before saying a routing or config change is done)
Project layout
app/routes, layouts,loading.tsx/error.tsx; route handlers inapp/api/**/route.tscomponents/shared UI;components/ui/primitiveslib/server and shared utilities;lib/server/must never be imported by client components<db/ or prisma/>schema and migrations
Rules
- Server Components by default. Add
"use client"only for state, effects, event handlers or browser APIs, and keep client components small and at the leaves. - Fetch data in Server Components or route handlers, not in
useEffect. - Mutations: Server Actions or route handlers; validate every input with
on the server. Never trust client-side validation alone. - Secrets only in server code. Only variables prefixed
NEXT_PUBLIC_reach the browser; never put secrets in them. - Use
next/imagefor images (with width/height orfill+sizes) andnext/linkfor internal links. - Check how caching and revalidation are configured for a route before changing data fetching; state the caching behavior you intend in the PR.
- Accessibility: semantic HTML, labels on inputs, keyboard support for interactive elements.
Gotchas
- <Example:
middleware.tsruns on every request; keep it fast and free of database calls.> - <Example:
pnpm db:migrateneedsDATABASE_URLfrom.env.local.>
Definition of done
- Typecheck, lint and relevant tests pass (quote the commands you ran)
<pnpm> buildpasses for changes to routing, config or data fetching- No new
any, noconsole.logleft behind