Privacy first web analytics: one Next.js app that both collects events (the tracker and the collect routes) and reports on them (the dashboard).
- Language / Runtime: TypeScript 6, Node 22 (CI pins 22, README floor is 18.18)
- Framework: Next.js 16 App Router, React 19 (React Compiler enabled), ESM only
- Key dependencies: Prisma 7 (
@prisma/adapter-pg),@clickhouse/client, TanStack Query, Zustand,@umami/react-zen(the UI kit), next-intl, Zod - Data: PostgreSQL always, plus ClickHouse and optional Kafka and Redis once scaled
- Package manager: pnpm 10.15.1
<TBD, set by /scope>
pnpm install # install
pnpm dev # dev server (Turbopack, loads .env)
pnpm build # full build: env check, prisma client, tracker, recorder, geo, app
pnpm test # Vitest unit and component tests
pnpm test:e2e # Playwright end to end tests
pnpm check # Biome lint and format, writes fixesStored in docs/specs/. Format: docs/specs/NNNN-title.md.
- Import through the
@/alias, which maps tosrc/. No deep relative climbs. - Biome is the only linter and formatter: single quotes, trailing commas, 2 space indent, 100 column width. Run
pnpm checkbefore you commit. - Pull requests target the
devbranch, nevermaster. See CONTRIBUTING.md. - Never touch a database client from a route or component. Reads and writes go through
src/queries. - Every API route validates with Zod, authenticates through
parseRequest, checks a@/permissionsfunction, and replies through the helpers insrc/lib/response.ts. - No user facing string is hardcoded. Add a key to
src/components/messages.tsand read it withuseMessages(). - Build UI from
@umami/react-zenprimitives first. Reach for a CSS module only when a primitive cannot do it. - Tests sit beside the code they cover as
*.test.tsor*.test.tsx. Details in src/test/README.md. src/generated/andpublic/script.jsare build output. Never edit them by hand.
- clickhouse-best-practices:
clickhouse/agent-skills, ClickHouse schema and query conventions, which govern the analytics half ofsrc/queries/sql - architect:
jsmastery-pro/skills, design decisions, ownsdocs/specs/ - audit:
jsmastery-pro/skills, bootstraps these context files - check:
jsmastery-pro/skills, verification and code review before merge - debug:
jsmastery-pro/skills, root cause loop for a failing behavior - develop:
jsmastery-pro/skills, builds a feature from an approved spec - document:
jsmastery-pro/skills, PR text, changelogs, release notes - scope:
jsmastery-pro/skills, keepsdocs/scope/current - sync:
jsmastery-pro/skills, refreshes these files after a change - test:
jsmastery-pro/skills, writes the suite for new code
MCP servers: prisma (recommended, needs authorizing)
- src/app/api/AGENTS.md: the API surface, request parsing, permissions, response shape
- src/queries/AGENTS.md: the two database query layer, Prisma plus ClickHouse
- src/components/AGENTS.md: UI kit, hooks, data fetching, translated copy
- src/tracker/AGENTS.md: the browser tracker script and its hard constraints
Drafted by /audit from the repo, worth a quick human pass. Edit freely: once a line stops matching this draft, later runs treat it as curated and will flag rather than overwrite it.