File size: 14,558 Bytes
9eafd9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# Tasks: Full-Stack Integration & UI Experience

**Input**: Design documents from `/specs/002-fullstack-ui-integration/`
**Prerequisites**: plan.md, spec.md, research.md, data-model.md, contracts/, quickstart.md

**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.

**Note**: Tests are not included as they were not explicitly requested in the feature specification. This feature focuses on integration and polish of existing functionality.

## Format: `[ID] [P?] [Story] Description`

- **[P]**: Can run in parallel (different files, no dependencies)
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
- Include exact file paths in descriptions

## Path Conventions

- **Web app**: `backend/src/`, `frontend/src/`
- All paths are relative to repository root

---

## Phase 1: Setup (6 tasks)

**Purpose**: Verify project structure and dependencies

- [x] T001 Verify backend project structure matches plan.md (backend/src/ with api/, core/, models/, schemas/, services/)
- [x] T002 Verify frontend project structure matches plan.md (frontend/src/ with app/, components/, lib/, providers/)
- [x] T003 [P] Verify backend dependencies installed (FastAPI, SQLModel, PyJWT, passlib, alembic)
- [x] T004 [P] Verify frontend dependencies installed (Next.js 16+, React 18+, TypeScript 5.x, Tailwind CSS 3.x)
- [x] T005 [P] Verify database connection works (backend can connect to PostgreSQL)
- [x] T006 [P] Verify environment variables exist (backend/.env and frontend/.env.local)

**Checkpoint**: Project structure and dependencies verified

---

## Phase 2: Foundational (7 tasks)

**Purpose**: Verify core infrastructure from Specs 1 & 2 works correctly

**⚠️ CRITICAL**: These tasks verify existing implementations are functional before adding UI polish

- [x] T007 Verify auth router is registered in backend/src/main.py (POST /api/auth/signup, POST /api/auth/signin, GET /api/auth/me)
- [x] T008 Verify task router is registered in backend/src/main.py (GET/POST /api/tasks, GET/PUT/PATCH/DELETE /api/tasks/{id})
- [x] T009 [P] Verify JWT token generation works in backend/src/core/security.py (create_access_token function)
- [x] T010 [P] Verify JWT token verification works in backend/src/api/deps.py (get_current_user dependency)
- [x] T011 [P] Verify API client exists in frontend/src/lib/api.ts with fetchAPI function
- [x] T012 [P] Verify AuthProvider exists in frontend/src/providers/AuthProvider.tsx with session management
- [x] T013 Test end-to-end flow: signup → signin → create task → signout (manual verification)

**Checkpoint**: Foundation verified - all existing implementations functional

---

## Phase 3: User Story 1 - Complete Authentication Flow (Priority: P1) 🎯 MVP (8 tasks)

**Goal**: Ensure seamless authentication experience from signup to task management

**Independent Test**: Navigate to application URL, complete signup, signin, and land on task management page with user profile displayed

### Implementation for User Story 1

- [x] T014 [P] [US1] Verify signup page exists at frontend/src/app/auth/signup/page.tsx with validation
- [x] T015 [P] [US1] Verify signin page exists at frontend/src/app/auth/signin/page.tsx with validation
- [x] T016 [US1] Verify protected route redirect in frontend/src/app/page.tsx (redirects unauthenticated users to signin)
- [x] T017 [US1] Add user profile display to header in frontend/src/app/layout.tsx (show "Welcome, {name}" when authenticated)
- [x] T018 [US1] Add signout button to header in frontend/src/app/layout.tsx (clears session and redirects to signin)
- [x] T019 [US1] Verify inline validation errors display in frontend/src/components/auth/SignUpForm.tsx (email, password, name)
- [x] T020 [US1] Verify inline validation errors display in frontend/src/components/auth/SignInForm.tsx (email, password)
- [x] T021 [US1] Test complete authentication flow: signup → signin → home page → signout (manual validation per quickstart.md)

**Checkpoint**: User Story 1 complete - authentication flow works end-to-end with proper UI feedback

---

## Phase 4: User Story 2 - Responsive UI States (Priority: P2) (8 tasks)

**Goal**: Provide clear visual feedback during all application states

**Independent Test**: Sign in, observe loading spinner, create first task and see empty state disappear, disconnect network and see error state

### Implementation for User Story 2

- [x] T022 [P] [US2] Add loading state to TaskList in frontend/src/components/tasks/TaskList.tsx (spinner with "Loading tasks..." message)
- [x] T023 [P] [US2] Add empty state to TaskList in frontend/src/components/tasks/TaskList.tsx (centered "No tasks yet" with CTA)
- [x] T024 [P] [US2] Add error state to TaskList in frontend/src/components/tasks/TaskList.tsx (error message with retry button)
- [x] T025 [P] [US2] Add loading state to TaskForm in frontend/src/components/tasks/TaskForm.tsx (disable submit button, show "Creating...")
- [x] T026 [US2] Add token expiration handling in frontend/src/lib/api.ts (redirect to signin with "Session expired" message on 401)
- [x] T027 [US2] Implement optimistic update for task completion in frontend/src/components/tasks/TaskItem.tsx (immediate UI update with rollback on error)
- [x] T028 [US2] Add loading state to task update operations in frontend/src/components/tasks/TaskItem.tsx (disable buttons during update)
- [x] T029 [US2] Test all UI states: loading, empty, error, token expiration (manual validation per quickstart.md)

**Checkpoint**: User Story 2 complete - all UI states provide clear feedback

---

## Phase 5: User Story 3 - Responsive Design (Priority: P3) (8 tasks)

**Goal**: Ensure application works seamlessly across desktop, tablet, and mobile devices

**Independent Test**: Open application at 1920px, 768px, and 375px viewports - verify layouts adjust appropriately

### Implementation for User Story 3

- [x] T030 [P] [US3] Verify/refine desktop layout in frontend/src/app/page.tsx (3-column: form, filters, list at ≥1024px)
- [x] T031 [P] [US3] Verify/refine tablet layout in frontend/src/app/page.tsx (2-column: form+filters, list at 768px-1023px)
- [x] T032 [P] [US3] Verify/refine mobile layout in frontend/src/app/page.tsx (1-column: stacked at <768px)
- [x] T033 [P] [US3] Verify touch target sizes in all buttons (min-h-[44px] min-w-[44px] classes)
- [x] T034 [P] [US3] Verify form responsiveness in frontend/src/components/auth/SignInForm.tsx (centered, readable on mobile)
- [x] T035 [P] [US3] Verify form responsiveness in frontend/src/components/auth/SignUpForm.tsx (centered, readable on mobile)
- [x] T036 [US3] Test responsive layouts at breakpoints: 375px (mobile), 768px (tablet), 1920px (desktop) using browser DevTools
- [x] T037 [US3] Verify no horizontal scrolling at any viewport width (manual validation per quickstart.md)

**Checkpoint**: User Story 3 complete - responsive design works across all devices

---

## Phase 6: User Story 4 - Centralized API Communication (Priority: P4) (7 tasks)

**Goal**: Ensure all API communication flows through unified client with consistent error handling

**Independent Test**: Review codebase to verify all API calls use fetchAPI, test JWT inclusion and 401 handling

### Implementation for User Story 4

- [x] T038 [P] [US4] Verify fetchAPI includes JWT token automatically in frontend/src/lib/api.ts (Authorization: Bearer header)
- [x] T039 [P] [US4] Verify 401 handling redirects to signin in frontend/src/lib/api.ts (clear session and redirect)
- [x] T040 [P] [US4] Verify error formatting consistency in frontend/src/lib/api.ts (APIError with detail, error_code, field_errors)
- [x] T041 [US4] Audit all components to ensure they use fetchAPI (TaskList, TaskForm, TaskItem, SignUpForm, SignInForm)
- [x] T042 [US4] Add timeout handling to fetchAPI in frontend/src/lib/api.ts (show "Unable to connect to server" on timeout)
- [x] T043 [US4] Test error scenarios: 401 Unauthorized, 500 Internal Server Error, network timeout (manual validation)
- [x] T044 [US4] Verify no unhandled promise rejections in browser console during error scenarios

**Checkpoint**: User Story 4 complete - API communication is centralized and consistent

---

## Phase 7: User Story 5 - Environment Coordination (Priority: P5) (6 tasks)

**Goal**: Ensure developers can set up and run the application easily

**Independent Test**: Follow README instructions to set up environment variables, start servers, and verify end-to-end functionality

### Implementation for User Story 5

- [x] T045 [P] [US5] Update backend/README.md with setup instructions (database setup, environment variables, migrations, server start)
- [x] T046 [P] [US5] Update frontend/README.md with setup instructions (environment variables, dependencies, server start)
- [x] T047 [P] [US5] Document all environment variables in backend/README.md (DATABASE_URL, BETTER_AUTH_SECRET, JWT_ALGORITHM, JWT_EXPIRATION_DAYS)
- [x] T048 [P] [US5] Document all environment variables in frontend/README.md (NEXT_PUBLIC_API_URL, BETTER_AUTH_SECRET)
- [x] T049 [US5] Add environment variable validation on backend startup in backend/src/main.py (check required vars, show clear errors)
- [x] T050 [US5] Test setup from scratch: clone repo, follow README, verify application works (manual validation per quickstart.md)

**Checkpoint**: User Story 5 complete - environment setup is documented and validated

---

## Phase 8: Polish & Cross-Cutting Concerns (4 tasks)

**Purpose**: Final refinements and validation

- [x] T051 [P] Code cleanup: Remove console.logs, unused imports, commented code across frontend/src/
- [x] T052 [P] Verify all Tailwind CSS classes are used correctly (no inline styles) across frontend/src/
- [ ] T053 Manual testing: Complete all test scenarios in specs/002-fullstack-ui-integration/quickstart.md
- [ ] T054 Final validation: Run through all 5 user stories end-to-end and verify acceptance criteria

**Checkpoint**: Feature complete and ready for demo/review

---

## Dependencies & Execution Order

### Phase Dependencies

- **Setup (Phase 1)**: No dependencies - can start immediately
- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
- **User Stories (Phase 3-7)**: All depend on Foundational phase completion
  - User stories can proceed in parallel (if staffed)
  - Or sequentially in priority order (P1 → P2 → P3 → P4 → P5)
- **Polish (Phase 8)**: Depends on all user stories being complete

### User Story Dependencies

- **User Story 1 (P1 - MVP)**: Can start after Foundational (Phase 2) - No dependencies on other stories
- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - Independent of US1 but builds on existing components
- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - Independent of US1/US2
- **User Story 4 (P4)**: Can start after Foundational (Phase 2) - Independent of US1/US2/US3
- **User Story 5 (P5)**: Can start after Foundational (Phase 2) - Independent of all other stories

### Within Each User Story

- Tasks marked [P] can run in parallel (different files)
- Tasks without [P] may have dependencies on previous tasks in the same story
- Complete all tasks in a story before moving to next priority

### Parallel Opportunities

- **Phase 1**: T003, T004, T005, T006 can run in parallel
- **Phase 2**: T009, T010, T011, T012 can run in parallel
- **Phase 3 (US1)**: T014, T015 can run in parallel
- **Phase 4 (US2)**: T022, T023, T024, T025 can run in parallel
- **Phase 5 (US3)**: T030, T031, T032, T033, T034, T035 can run in parallel
- **Phase 6 (US4)**: T038, T039, T040 can run in parallel
- **Phase 7 (US5)**: T045, T046, T047, T048 can run in parallel
- **Phase 8**: T051, T052 can run in parallel

---

## Parallel Example: User Story 2 (Responsive UI States)

```bash
# Launch all UI state additions in parallel:
Task: "Add loading state to TaskList in frontend/src/components/tasks/TaskList.tsx"
Task: "Add empty state to TaskList in frontend/src/components/tasks/TaskList.tsx"
Task: "Add error state to TaskList in frontend/src/components/tasks/TaskList.tsx"
Task: "Add loading state to TaskForm in frontend/src/components/tasks/TaskForm.tsx"
```

---

## Implementation Strategy

### MVP First (User Story 1 Only)

1. Complete Phase 1: Setup (6 tasks)
2. Complete Phase 2: Foundational (7 tasks) - CRITICAL
3. Complete Phase 3: User Story 1 (8 tasks)
4. **STOP and VALIDATE**: Test authentication flow end-to-end
5. Demo/review if ready

**Total MVP tasks**: 21 tasks

### Incremental Delivery

1. Complete Setup + Foundational → Foundation verified (13 tasks)
2. Add User Story 1 → Test independently → Demo (MVP!) (8 tasks)
3. Add User Story 2 → Test independently → Demo (8 tasks)
4. Add User Story 3 → Test independently → Demo (8 tasks)
5. Add User Story 4 → Test independently → Demo (7 tasks)
6. Add User Story 5 → Test independently → Demo (6 tasks)
7. Polish → Final validation → Demo (4 tasks)

**Total tasks**: 54 tasks

### Parallel Team Strategy

With multiple developers:

1. Team completes Setup + Foundational together (13 tasks)
2. Once Foundational is done:
   - Developer A: User Story 1 (8 tasks)
   - Developer B: User Story 2 (8 tasks)
   - Developer C: User Story 3 (8 tasks)
3. Then:
   - Developer A: User Story 4 (7 tasks)
   - Developer B: User Story 5 (6 tasks)
   - Developer C: Polish (4 tasks)

---

## Task Summary

| Phase | User Story | Task Count | Parallel Tasks |
|-------|------------|------------|----------------|
| Phase 1: Setup | - | 6 | 4 |
| Phase 2: Foundational | - | 7 | 4 |
| Phase 3: US1 (MVP) | Complete Authentication Flow | 8 | 2 |
| Phase 4: US2 | Responsive UI States | 8 | 4 |
| Phase 5: US3 | Responsive Design | 8 | 6 |
| Phase 6: US4 | Centralized API Communication | 7 | 3 |
| Phase 7: US5 | Environment Coordination | 6 | 4 |
| Phase 8: Polish | Cross-Cutting Concerns | 4 | 2 |
| **TOTAL** | **5 User Stories** | **54** | **29** |

---

## Notes

- [P] tasks = different files, no dependencies - can run in parallel
- [Story] label maps task to specific user story for traceability
- Each user story should be independently completable and testable
- Most tasks are verification/refinement since Specs 1 & 2 already implemented core functionality
- Focus is on UI polish (loading states, empty states, error handling) and integration
- Manual testing per quickstart.md is critical for validation
- Commit after each task or logical group
- Stop at any checkpoint to validate story independently