app/: Next.js App Router pages, layouts, and route handlers (API underapp/api/*).components/: Shared React components (design-system primitives incomponents/ui/).lib/: Core application logic (DB access, GitHub integrations, services, shared utilities).hooks/: Reusable React hooks (naming pattern:use-*.ts(x)).__tests__/: Jest tests (__tests__/libfor unit-ish logic,__tests__/apifor route-handler coverage).migrations/: SQL migration files (ordered00x_*.sql).scripts/: One-off Node scripts (e.g.scripts/generate-mock-data.js).public/: Static assets served by Next.js.
- Start with
docs/README.mdfor reading order and architecture entrypoints. - Canonical architecture map:
docs/architecture/README.md. - Current migration state (core vs legacy modules):
docs/architecture/migration-status.md. - Route-level implementation playbook:
docs/playbooks/change-routing.md. - Machine-readable architecture contracts:
docs/architecture/repository-manifest.jsondocs/architecture/dependency-rules.json
pnpm install: Install dependencies (pnpm is the expected package manager).pnpm dev: Run local dev server (Next.js with Turbopack).pnpm build/pnpm start: Production build and local production server.pnpm lint: Run ESLint and architecture harness checks across the repo.pnpm architecture:check: Validate architecture manifest and dependency boundaries.pnpm test: Run the full Jest suite.pnpm test:watch: Watch mode for local iteration.pnpm test:unit/pnpm test:integration: Narrow runs for__tests__/liband__tests__/api.pnpm test:ci: CI-style run with coverage enabled.
- TypeScript is in
strictmode; prefer explicit types at module boundaries and for public helpers inlib/. - Use the path alias
@/…for internal imports (configured intsconfig.json). - Keep components in PascalCase and hooks in the
use-*.ts(x)pattern; colocate component-specific helpers nearby. - Treat
pnpm-lock.yamlas authoritative; update it only viapnpm.
- Jest +
next/jestwithjsdom; tests live under__tests__/and use*.test.ts(x). - Global coverage thresholds are enforced (see
jest.config.js); include tests for new logic and bug fixes.
- Commit messages in history are short and topic-focused (e.g. “cleanup”, “db optimizations”); prefer an imperative summary and add an optional scope when helpful (
auth: …,db: …). - PRs should be small and atomic, include a clear description, and add screenshots for UI changes; run
pnpm lintand relevantpnpm test:*commands before requesting review.
- Create local config via
cp environment.example .env.local(seeENVIRONMENT_SETUP.mdfor GitHub/Turso details). - For a fresh Turso database in development, initialize schema via
curl -X POST http://localhost:3000/api/migrate. - Never commit secrets or private keys; avoid logging raw tokens, webhook secrets, or JWT material.