# CRA Manager - Compte Rendu d'Activité ## Overview A French timesheet management application (CRA - Compte Rendu d'Activité) built as a pnpm workspace monorepo. Consultants use it to track and report hours worked across multiple projects each month. ## Stack - **Monorepo tool**: pnpm workspaces - **Node.js version**: 24 - **Package manager**: pnpm - **TypeScript version**: 5.9 - **Frontend**: React + Vite + Tailwind CSS + shadcn/ui - **API framework**: Express 5 - **Database**: PostgreSQL + Drizzle ORM - **Validation**: Zod (`zod/v4`), `drizzle-zod` - **API codegen**: Orval (from OpenAPI spec) - **Build**: esbuild (CJS bundle) - **Charts**: Recharts - **Routing**: Wouter ## Features - **Dashboard**: Overview with monthly hours chart, project breakdown, active project count, timesheet status - **Timesheet Management**: Create, view, edit monthly timesheets (CRA) - **CRA Grid**: Interactive calendar grid where rows = projects, columns = days of month. Click cells to cycle 0 → 0.5 → 1 hours. Weekend distinction, row/column totals - **Project Management**: CRUD for projects with code, name, client, category - **Timesheet Workflow**: Draft → Submitted → Validated status flow ## Database Schema - `projects` — Project definitions (code, name, client, category) - `timesheets` — Monthly timesheet headers (year, month, status, collaborator) - `timesheet_lines` — Project assignments within a timesheet - `time_entries` — Daily hour entries per line (date, hours) ## Key Commands - `pnpm run typecheck` — full typecheck across all packages - `pnpm run build` — typecheck + build all packages - `pnpm --filter @workspace/api-spec run codegen` — regenerate API hooks and Zod schemas from OpenAPI spec - `pnpm --filter @workspace/db run push` — push DB schema changes (dev only) - `pnpm --filter @workspace/api-server run dev` — run API server locally ## API Endpoints - `GET/POST /api/projects` — List/create projects - `GET/PATCH/DELETE /api/projects/:id` — Project CRUD - `GET/POST /api/timesheets` — List/create timesheets (filter by year/month) - `GET/PATCH/DELETE /api/timesheets/:id` — Timesheet CRUD (GET returns full detail with lines and entries) - `GET/POST /api/timesheets/:id/lines` — Timesheet lines - `DELETE /api/timesheets/:id/lines/:lineId` — Remove a line - `PUT /api/timesheets/:id/entries` — Batch upsert time entries - `GET /api/dashboard/summary` — Dashboard stats - `GET /api/dashboard/monthly-hours` — Monthly hours breakdown - `GET /api/dashboard/project-hours` — Hours per project See the `pnpm-workspace` skill for workspace structure, TypeScript setup, and package details.