INSTRUCTION FOR AGENTS: Read this file FIRST before exploring the codebase. This provides pre-built context to minimize exploration tokens.
Name: ExampleApp Description: A full-stack web application for managing tasks Type: Monorepo with web app and API Package Manager: pnpm
example-app/
├── src/ # Next.js web app source
│ ├── app/ # Next.js App Router (pages + API routes)
│ │ ├── api/v1/ # Versioned public API endpoints
│ │ ├── dashboard/ # Dashboard pages
│ │ └── settings/ # Settings pages
│ ├── components/ # React components by feature
│ │ ├── ui/ # Shared UI primitives
│ │ ├── tasks/ # Task-related components
│ │ └── layout/ # Layout components
│ ├── lib/ # Shared utilities
│ │ ├── db/ # Database queries/mutations
│ │ └── utils/ # General utilities
│ ├── types/ # TypeScript type definitions
│ └── hooks/ # Custom React hooks
├── prisma/ # Prisma schema and migrations
├── scripts/ # Utility scripts
└── docs/ # Project documentation
tasks/route.ts- CRUD for taskstasks/[id]/route.ts- Individual task operationsusers/route.ts- User management
queries.ts- Read queriesmutations.ts- Write operationsclient.ts- Prisma client singleton
tasks/task_card.tsx- Task display cardtasks/task_list.tsx- Task list with filterslayout/header.tsx- Main navigation header
- Files:
snake_case.ts(e.g.,task_card.tsx) - Functions:
camelCase(e.g.,createTask) - Types:
PascalCase(e.g.,Task,User) - Components:
PascalCase(e.g.,TaskCard)
- Use
typeoverinterfaceunless interface merging needed - Use named exports over default exports
- Use async/await over .then() chains
- Use early returns to reduce nesting
- Use
@/path alias for imports (maps tosrc/)
- Colocate tests:
*.spec.tsnext to source files - Use Vitest with jsdom for React components
- Group tests under
describe(functionName, ...)
| Layer | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript (strict) |
| Styling | Tailwind CSS |
| Database | PostgreSQL + Prisma |
| Auth | NextAuth.js |
| Testing | Vitest |
| Hosting | Vercel |
| Table | Purpose |
|---|---|
users |
User accounts |
tasks |
Task items with status |
tags |
Tags for categorizing tasks |
- NEVER push code with type errors - Pre-commit hook enforces this
- Colocate tests - Put
*.spec.tsnext to source files - Use Conventional Commits -
feat:,fix:,docs:, etc. - API routes are public - Design for third-party use
# Development
pnpm dev # Start dev server
# Quality gates
pnpm typecheck # TypeScript check
pnpm lint # ESLint
pnpm test # Run tests
# Database
pnpm db:push # Push schema changes
pnpm db:generate # Generate Prisma clientRequired in .env.local:
DATABASE_URL- PostgreSQL connection stringNEXTAUTH_SECRET- Auth encryption keyNEXTAUTH_URL- App URL for auth callbacks
- Port 3000: Dev server runs on default port 3000
- Prisma client: Must regenerate after schema changes
- Pre-commit hooks: All quality gates must pass before commit
- Task: A work item with title, description, status, and due date
- Status:
pending,in_progress,completed,archived - Tag: A label for categorizing tasks
- User submits task form
- API validates input
- Task saved to database
- UI updates optimistically