This document translates docs/requirements.md into an actionable, phase-based roadmap. Follow the steps in sequence; each phase produces runnable code, tests, and documentation before moving on.
- Deliver every functional/non-functional requirement in
docs/requirements.md, prioritizing CRUD workflows, filtering/sorting, resilient UX states, and maintainable architecture. - Preserve the feature-first layout that already exists in
src/, leveraging MUI v7.3.6, Tailwind CSS v4.1.17, Zustand 5.0.9, React Query 5.90.12, Ky 1.14.1, React Hook Form 7.68.0, Zod 4.1.13, and Vitest 4.0.15 tooling. - Keep quality gates green (
pnpm lint,pnpm test,pnpm build) at each phase boundary, and maintain Storybook documentation for UI primitives.
- Type Safety: All modules must compile with TS strict mode and expose types via
index.tsbarrels. Runtime contracts validated with Zod. - State Management: React Query owns server state with optimistic updates; Zustand owns client-side UI state; hooks orchestrate async flows.
- UX Consistency: Use MUI first, Tailwind utility classes for gaps/layout only. Provide loading, error, and empty states for all async views. Toast notifications via
notistackwrappers. - Testing: Co-locate Vitest + RTL suites (
__tests__) beside source. Stub network with MSW. Add Storybook stories for visual documentation.
| Area | Key Files |
|---|---|
| Shared foundation | src/shared/api/httpClient.ts, src/shared/config/env.ts, src/shared/hooks/useSnackbar.ts, src/shared/lib/date.ts, src/shared/lib/format.ts, src/shared/lib/error.ts, src/shared/types/task.types.ts, src/test/setup.ts, src/test/mocks/**/*.ts |
| Tasks feature | src/features/tasks/{services,validation,hooks,components}/**, plus index.ts barrels and stories/tests |
| Lists feature | src/features/lists/{hooks,components}/**, index.ts, stories/tests |
| App shell | src/app/{providers.tsx,routes.tsx}, src/app/App.tsx, src/pages/TasksPage.tsx, shared UI components |
| QA & documentation | docs/requirements.md (source of truth), Storybook config, Vitest coverage reports |
Each phase has explicit deliverables and verification steps. Finish all subtasks (including tests) before advancing.
-
1. Domain Types (
src/shared/types/task.types.ts)- Define task primitives:
TaskPriority,TaskStatus,Task,TaskDraft,TaskUpdate,TaskFilters,TaskSortField,TaskSortOption. - API returns camelCase payloads (httpClient auto-converts), so a single
Taskshape is shared between client and server. - Include helper maps (
PRIORITY_ORDER,DEFAULT_FILTERS,DEFAULT_SORT) for reuse across hooks/components. - Export via barrel for downstream consumers.
- Define task primitives:
-
2. Runtime Validation (
src/features/tasks/validation/task.schema.ts)- Create Zod schemas mirroring the domain types; provide resolver for React Hook Form.
- Centralize default values and string trimming logic.
-
3. Environment & HTTP Client
src/shared/config/env.tscovers API base URL, timeout, and debug flags with type-safe accessors.src/shared/api/httpClient.tsusing Ky: JSON headers, snake/camel conversion, retry policy, structured error normalization (ApiError class), optional debug logging.
-
4. Shared Hooks & State
useSnackbar.ts: wrapnotistack'suseSnackbar, exposeshowSuccess,showError,showWarning,showInfo,showand utility helpers (auto-dismiss, action buttons).- React Query: Setup
QueryClientwith global defaults (staleTime, retry) andQueryClientProviderinproviders.tsx.
-
5. Utilities (
src/shared/lib)date.ts: helpers (parseDateString,formatDate,isOverdue,getDaysUntilDue, etc.).format.ts: priority labels, truncation helpers, task metadata formatting.error.ts: error categorization (getErrorInfo,isNetworkError,extractStatusCode), HTTP error messages, network/component error constants.
-
6. Test & Storybook Setup
src/test/setup.tsregisters@testing-library/jest-dom/vitest, configures MSW server lifecycle hooks.src/test/setup-env.tssets up test environment variables and polyfills.src/test/mocks/contains MSW handlers and server configuration.- Storybook configuration loads Tailwind styles and MUI theme.
-
7. Error Handling Infrastructure
AppErrorBoundary.tsx: Catches React errors, shows context-aware recovery actionsErrorPage.tsx: Router error boundary and custom error display component- Comprehensive error utilities in
shared/lib/error.ts
-
1. Service Layer (
task.service.ts)- Implement CRUD helpers (
getAll,getById,create,update,delete). - All methods use httpClient and return typed promises.
- Implement CRUD helpers (
-
2. React Query Hooks
useTasks.ts: Query hook with client-side filtering and sorting, provides derived counts (total, active, completed).useTaskActions.ts: Mutation hooks for create/update/delete with optimistic updates, snackbar feedback, and rollback on error. Includes query key factory (taskKeys).
-
3. Validation Schemas
- Zod schemas for task creation and updates with React Hook Form resolver.
-
4. Type Definitions
- Complete domain model in
shared/types/task.types.ts.
- Complete domain model in
-
5. Zustand Store (Minimal)
tasks.store.ts: Basic store for UI-specific state (React Query handles server state).
-
6. UI Components
⚠️ STUBS ONLYTaskList.tsx: Orchestrate loading/error/empty states, render list with proper structure.TaskItem.tsx: Show checkbox, title, metadata chips, inline menu for edit/delete; accessibility (aria labels, focus order).TaskForm.tsx: React Hook Form + MUI inputs (title, description, due date picker, priority select). Integrate Zod resolver and inline validation messaging.TaskEmptyState.tsx,TaskErrorState.tsx: Dedicated components with CTA/retry actions.- All components currently are placeholder stubs.
-
7. Unit Tests
- Service tests with MSW mocking
- Hook tests (useTasks, useTaskActions) with React Query testing
- Validation schema tests
-
8. Component Tests
⚠️ PENDING UI IMPLEMENTATION- Stories per UI state
- Component interaction tests with RTL
-
9. Verification
pnpm test -- features/tasksandpnpm storybookto validate coverage and docs.
-
1. State Hook (
useListFilters.ts)- Manage local filter state (status, priority, sort field/direction); expose derived props for tabs/menus and callbacks (
setStatus,togglePriority,setSort). - Future-proof with optional URL sync placeholder API.
- Manage local filter state (status, priority, sort field/direction); expose derived props for tabs/menus and callbacks (
-
2. Components
StatusTabs.tsx: MUI<Tabs>for All/Active/Completed; keyboard accessible.FilterBar.tsx: Compose status tabs, priority chips, search stub (if planned), and space for future filters.SortMenu.tsx: Button-triggered menu to pick sort field + direction; ensure tasks without due dates sort last when due-date sort is active.- All components accept props-only dependencies; no direct store access.
-
3. Integration & Tests
- Provide stories showing combined filter/sort interactions.
- RTL tests for
useListFiltersand components to ensure callbacks fire and ARIA contracts hold.
-
4. Verification
pnpm test -- features/listsand review Storybook controls.
-
1. Providers (
src/app/providers.tsx)- Ensure React Router, MUI theme provider, React Query client, Snackbar provider are wired once. MSW starts in dev/test.
-
2. Routing (
src/app/routes.tsx,src/app/App.tsx)- Register Tasks route as default; add ErrorBoundary wrappers per route; lazy-load future routes.
-
3. Layout (
src/shared/ui/AppLayout.tsx,AppErrorBoundary.tsx,ErrorPage.tsx,LoadingSkeleton.tsx)- Implement responsive layout with header, content container, and slots for toasts.
- Error boundary fallback uses ErrorPage component.
-
4. Tasks Page (
src/pages/TasksPage.tsx)⚠️ PENDING COMPONENTS- Compose
FilterBar,SortMenu,TaskList, andTaskFormmodal logic. - On mount, use
useTasks()hook; pass filter/sort state fromuseListFilters(when available). - Wire optimistic updates via
useTaskActionsmutations.
- Compose
-
5. Global Store Barrel (
src/store/index.ts)- Re-export Zustand hooks/selectors to keep imports consistent.
-
6. Verification
- Manual QA run-through: load tasks, create/edit/delete, apply filters/sorts, observe loading/error states.
pnpm devfor smoke test; log issues for next phase if any.
-
1. Automated Testing
- Reach ≥80% coverage focusing on services, hooks, and complex components.
- Add integration tests exercising: full CRUD happy path, filter/sort combos, optimistic update rollback, and snackbar feedback.
-
2. Accessibility & Performance
- Audit key pages with axe/Storybook accessibility addon; fix WCAG violations.
- Measure bundle via
pnpm build; flag chunks > recommended size.
-
3. Documentation
- Update
README.mdwith setup/run instructions, environment variables, and testing commands. - Capture API expectations and MSW conventions inside docs.
- Update
-
4. Operational Checklist
- Verify
.env.examplematches required vars. - Run
pnpm lint,pnpm test,pnpm buildsequentially. Document any known issues/blockers.
- Verify
- Shared foundation (types, env, http client, hooks, utilities, tests) completed.
- Task service layer and React Query hooks implemented with tests.
- Task UI components implemented (currently stubs).
- Lists feature delivers filtering/sorting state + components with coverage.
- App shell wires providers, layout, routing, and Tasks page composition.
- Quality gate reports (tests, lint, build, accessibility) captured prior to release.
- React: 19.2.1 with TypeScript 5.9.3
- Build: Vite (Rolldown) 7.2.3
- Package Manager: pnpm
- UI: Material-UI 7.3.6 + Tailwind CSS 4.1.17
- State: Zustand 5.0.9 (client) + TanStack Query 5.90.12 (server)
- Forms: React Hook Form 7.68.0 + Zod 4.1.13
- HTTP: Ky 1.14.1 with automatic camelCase/snake_case conversion
- Testing: Vitest 4.0.15 + Testing Library 16.3.0 + MSW 2.12.4
- Notifications: notistack 3.0.2
Use this spec as the implementation contract. Commit incrementally per phase, keep documentation updated, and ensure each step satisfies the corresponding requirement before moving on.