app/Next.js App Router pages, layouts, route handlers, and global styles.action/Server Actions for mutations and workflow operations.components/Feature UI;components/ui/holds shadcn/ui primitives.db/Drizzle schema and database client; SQL migrations live inmigrations/.lib/Shared server utilities (session, Link, Feishu, email, AI, Sentry, DAL).queue/Inngest background jobs;emails/react-email templates.e2e/Playwright end-to-end specs; unit tests colocate as*.test.ts(x).docs/Product, schema, and integration documentation.public/Static assets.- Root configs:
next.config.ts,tsconfig.json,eslint.config.mjs,postcss.config.mjs,components.json,playwright.config.ts,jest.config.ts.
pnpm dev— Run Next.js in development on port3000.pnpm dev:full— Next.js (3001) + Inngest + email preview (3002).pnpm db:dev:up/pnpm db:dev:down— Local Docker PostgreSQL.pnpm db:migrate/pnpm db:seed:local/pnpm db:seed:demo— Schema and seed data.pnpm build/pnpm start— Production build and serve.pnpm lint— Run ESLint. Use--fixto auto-fix.pnpm test/pnpm test:watch/pnpm test:coverage— Jest.pnpm test:e2e— Playwright end-to-end suites.pnpm exec tsc --noEmit— Typecheck.
- Language: TypeScript with React 19 and Next.js 16.
- Linting:
eslint.config.mjsis the source of truth; keep code warning-free. - Styling: Tailwind CSS v4 (utility-first). Reuse existing shadcn/ui patterns.
- Components: PascalCase names/exports; files in
components/ui/mirror export names. - Routes: Next app files are lowercase (
page.tsx,layout.tsx). - Code: camelCase variables/functions; hooks start with
use*. - Prefer Server Components by default; keep
"use client"components small. - Identity, secrets, database access, and admin mutations stay on the server.
- Unit/component: Jest + Testing Library. Name tests
*.test.ts/*.test.tsxand colocate next to source. - End-to-end: Playwright specs under
e2e/, run withpnpm test:e2e. - Prioritize
lib/, Server Actions, access control, and critical workflow UI. - See TESTING.md for details and docs/RELEASE_CHECKLIST.md for release acceptance.
- Prefer Conventional Commits:
feat:,fix:,docs:,refactor:,chore:,ci:,test:. - Link issues in the footer:
Closes #123. - PRs should include: brief scope/intent, screenshots for UI changes, validation steps, and pass
pnpm lintplus related tests. - Keep changes focused; avoid unrelated refactors.
- Update README / docs when behavior, env vars, schema, or commands change.
- Use
.env.localfor secrets; do not commit.env*files..env.exampleis the template. - Only expose safe client values via
NEXT_PUBLIC_*. - Prefer Docker PostgreSQL for local development; keep Link/Feishu mock flags off outside controlled local stubs.
- People business data stores Link user IDs; the local
usertable is legacy fallback only.