4. Reference this file when dispatching improvement tasks
## Pending Recommendations
### Click-to-toggle Paid/Unpaid Status
**Priority:** HIGH
**Status:** ✅ COMPLETED v0.19.0
**Added:** 2026-05-08 by _null
**Description:**
Allow users to click directly on the "Paid", "Missed", "Late", "Due Soon", "Upcoming" status in the tracker to toggle between Paid and Unpaid states without opening the bill modal.
### Billing Cycle Sub-categories for Weekly/Monthly
**Priority:** MEDIUM
**Added:** 2026-05-08 by _null
**Description:**
Add sub-categories to billing cycles. Current cycles (1st, 15th, Other) work for monthly bills, but need weekly and monthly options with sub-categories for due dates.
**Rationale:**
Supports users with weekly bills (rent, subscriptions, etc.) and more complex monthly schedules. Requires backend schema changes and frontend updates.
- Add `cycle_subcategory` for specific day (e.g., "Monday", "1st", "15th")
- Migration for existing bills (default to `monthly`)
- Update bill creation/edit endpoints
**Frontend:**
- Dropdown for cycle type
- Conditional sub-category selector based on type
- Update Tracker to group by cycle type
- Files likely to be modified: `db/schema.sql`, `db/database.js`, `routes/bills.js`, `client/pages/BillsPage.jsx`, `client/components/BillModal.jsx`
- Estimated effort: 6-8 hours
---
### Previous Month Paid Amount on Tracker Page
**Priority:** MEDIUM
**Added:** 2026-05-08 by _null
**Description:**
Display the previous month's total paid amount on the Tracker page, positioned between "Expected" and "Paid" columns.
**Rationale:**
Context for users to compare current month spending vs. previous month at a glance. Helps with budgeting and spotting anomalies.
**Implementation Notes:**
- Fetch previous month's payment data alongside current month
- New column: "Last Month" between Expected and Paid
- Option to show/hide via settings
- Consider sparkline mini-chart for trend
- Files likely to be modified: `routes/tracker.js`, `client/pages/TrackerPage.jsx`
- Estimated effort: 3 hours
---
### 3-Month Trend Indicator with Up/Down Arrows
**Priority:** MEDIUM
**Added:** 2026-05-08 by _null
**Description:**
Add trend indicators showing whether the last 3 months of payments went up or down compared to current month. Display as up/down arrow with percentage change.
**Rationale:**
Visual trend indicator helps users identify spending patterns without navigating to Analytics page.
**Implementation Notes:**
- Calculate 3-month rolling average
- Compare current month vs. previous 3-month average
- Show green up arrow if trending up (more paid), red down arrow if trending down
- Display percentage change
- Position in Tracker header or Summary card
- Files likely to be modified: `routes/analytics.js` (new endpoint), `client/pages/TrackerPage.jsx` or `client/pages/SummaryPage.jsx`
- Estimated effort: 4 hours
---
### Add React.memo() to prevent unnecessary re-renders
**Priority:** HIGH
**Status:** ✅ COMPLETED v0.19.0
**Added:** 2026-05-08 by Scarlett
**Description:**
Many components render on every state change in the parent (especially App.jsx, TrackerPage.jsx, BillsPage.jsx), causing unnecessary re-renders of child components that don't depend on those specific state changes.
**Implementation:**
- Applied `React.memo()` to StatusBadge, SummaryCard, MobileBillRow, MobileTrackerRow, NavPill, and BrandBlock
- Extracted NavPill and BrandBlock to separate files in `client/components/layout/`
- Fixed missing React imports and useState bugs during implementation
- Build verified successful
**Files Modified:**
-`client/components/StatusBadge.jsx`
-`client/components/SummaryCard.jsx`
-`client/components/MobileBillRow.jsx`
-`client/components/MobileTrackerRow.jsx`
-`client/components/layout/NavPill.jsx` (new file)
-`client/components/layout/BrandBlock.jsx` (new file)
-`client/components/layout/Sidebar.jsx` (refactored to use new components)
### Implement proper error boundaries
**Priority:** CRITICAL
**Added:** 2026-05-08 by Scarlett
**Description:**
The app has no React error boundaries. When a component throws an error (network failure, unexpected data shape, etc.), the entire app crashes with a white screen and no clear path to recovery.
**Rationale:**
User experience and reliability. Currently, any JavaScript error in a component causes a complete app crash. Error boundaries would allow the app to display a fallback UI and potentially recover. This is especially important for production use where you can't predict all error conditions.
**Implementation Notes:**
- Create a generic `ErrorBoundary` component with fallback UI
- Wrap top-level pages (TrackerPage, BillsPage, AnalyticsPage) in error boundaries
- Wrap App.jsx router with error boundary
- Log errors to console and optionally to error tracking service
- Consider adding `componentDidCatch` class component wrapper for critical paths
- Files likely to be modified: Add new `client/components/ErrorBoundary.jsx`, wrap pages in App.jsx
- Estimated effort: 45-60 minutes
### Add loading skeletons and better async state management
**Priority:** MEDIUM
**Added:** 2026-05-08 by Scarlett
**Description:**
Many pages show only "Loading..." or no state between async API calls and data rendering. Pages like TrackerPage, AnalyticsPage, and BillsPage have inconsistent loading states.
**Rationale:**
Perceived performance. Users should see immediate visual feedback when data is loading, even if the actual data loads slowly. Skeleton loaders prevent layout shifts and set proper expectations about wait times.
**Implementation Notes:**
- Add loading skeleton components for:
- Summary cards (4 skeleton cards for TrackerPage)
- Table rows (skeleton rows for bills tracker tables)
- Chart placeholders (shimmer effect for analytics)
- Form fields (skeleton inputs for modals)
- Create reusable Skeleton components in `client/components/ui/Skeleton.jsx`
- Implement loading state with proper transitions (fade in/out)
- Consider adding `aria-busy` attributes during load
- Files likely to be modified: `client/components/ui/`, `client/pages/TrackerPage.jsx`, `client/pages/AnalyticsPage.jsx`, `client/pages/BillsPage.jsx`
- Estimated effort: 60-90 minutes
### Add keyboard navigation and accessible ARIA labels
**Priority:** HIGH
**Added:** 2026-05-08 by Scarlett
**Description:**
While many components use semantic HTML, several interactive elements lack proper ARIA attributes, keyboard navigation, or focus management, making the app inaccessible to screen reader users and keyboard-only users.
**Rationale:**
Accessibility compliance and broader user reach. Bill Tracker should be usable by everyone. WCAG 2.1 Level A compliance requires:
- Proper labeling of interactive elements
- Keyboard navigation support
- Focus management in modals
- Screen reader announcements for dynamic content
**Implementation Notes:**
- Audit all interactive components for missing ARIA labels:
- Buttons without `aria-label` or visible text
- Icons used as buttons
- Custom selects and dropdowns
- Modal dialogs (missing `role="dialog"` and `aria-modal`)
- Add focus management to modals (trap focus, return focus on close)
- Ensure keyboard navigation works through all pages
- Add proper `aria-live` regions for toast notifications
- Ensure color contrast meets WCAG AA standards (verify with axe DevTools)
- Files likely to be modified: `client/components/*.jsx`, `client/pages/*.jsx`
- Estimated effort: 2-3 hours for comprehensive audit and fixes
### Add React Query (TanStack Query) for server state management
**Priority:** MEDIUM
**Added:** 2026-05-08 by Scarlett
**Description:**
Currently using manual `useState`/`useEffect` patterns with custom `api` wrapper for data fetching. This leads to duplicated loading/error handling, stale data issues, and no request caching.
**Rationale:**
Developer experience and performance. React Query provides:
- Automatic request caching and stale-while-revalidate
- Background refetching
- Optimistic updates
- Request deduplication
- Built-in loading/error states
**Implementation Notes:**
- Replace manual API calls in pages with `useQuery`, `useMutation`
- Add query keys for cache invalidation
- Implement global query client with React Query DevTools
- Gradual migration: start with TrackerPage, then BillsPage, then AnalyticsPage
- Files likely to be modified: `client/pages/*.jsx`, add `client/hooks/useQueryClient.js`
- Estimated effort: 4-6 hours for full migration
### Add comprehensive unit and integration tests
**Priority:** LOW
**Added:** 2026-05-08 by Scarlett
**Description:**
Currently no unit tests exist for components or hooks. The only testing appears to be functional tests in `test-functional.js`. Component-level testing is missing.
**Rationale:**
Code quality and maintainability. Unit tests catch regressions and document component behavior. Bill Tracker has complex business logic (bill calculations, monthly state, analytics) that should be tested.
**Implementation Notes:**
- Set up Jest + React Testing Library
- Test key components: BillModal, TrackerPage row, BillsTableInner
- Test hooks: useAuth, custom form hooks
- Test utility functions in `client/lib/utils.js`
- Consider vitest for faster test execution
- Add CI integration for test execution
- Files likely to be modified: Add `client/test/` directory, add `jest.config.cjs`
- Estimated effort: 8-12 hours for baseline coverage
### Optimize bundle size and code splitting
**Priority:** LOW
**Added:** 2026-05-08 by Scarlett
**Description:
No code splitting is implemented. All JavaScript loads on initial page load, including rarely used pages like AdminPage (1873 lines) and DataPage (1583 lines).
### 🔴 CRITICAL: No Explicit Version Tracking for Migrations
**Priority:** CRITICAL
**Status:** PENDING
**Added:** 2026-05-09 by Neo
**Description:**
Database migrations lack explicit version tracking. System doesn't know which migrations have been applied, risking duplicate application or incomplete upgrades.
**Rationale:**
-`db/database.js``runMigrations()` has no tracking table
- No way to know which migrations have been applied vs. pending
- Migrations run every startup, relying only on IF NOT EXISTS checks
- Risk: if a migration partially fails, system doesn't know to retry or skip
**Implementation Notes:**
- Create `schema_migrations` tracking table
- Log each applied migration with timestamp
- Query table before running each migration
- Mark as CRITICAL for production deployment
---
### 🔴 CRITICAL: No Transaction Wrapping for Migrations
**Priority:** CRITICAL
**Status:** PENDING
**Added:** 2026-05-09 by Neo
**Description:**
Migrations are not atomic. If a migration fails partway through, database is left in inconsistent state with no rollback.
**Rationale:**
- Multi-statement migrations (ALTER TABLE + UPDATE + CREATE INDEX) not wrapped in transactions
- If step 2 fails, step 1 already committed
- No recovery mechanism for partially-applied migrations
- Risk: corrupt schema state that's hard to debug
**Implementation Notes:**
- Wrap each migration in BEGIN/COMMIT/ROLLBACK
- Error handling must ROLLBACK on any failure
- Log transaction state for debugging
- Test with intentional failures to verify rollback
---
### 🟠 HIGH: No Explicit Migration Dependency Management
**Priority:** HIGH
**Status:** PENDING
**Added:** 2026-05-09 by Neo
**Description:**
Migrations have implicit dependencies (e.g., adding columns to tables that must exist first) but no explicit dependency graph or ordering guarantee.
**Rationale:**
- Some migrations assume prior migrations have run
- Manual ordering in `runMigrations()` function is fragile
- Adding new migrations in wrong order could break schema
- No way to validate dependency chain
**Implementation Notes:**
- Create migration function objects with explicit `dependsOn` list
- Validate dependency graph before running migrations
- Enforce topological sort order
- Test dependency failures to ensure proper error messages
---
### 🟡 MEDIUM: No Rollback Capability for Failed Migrations
**Priority:** MEDIUM
**Status:** PENDING
**Added:** 2026-05-09 by Neo
**Description:**
No way to rollback or recover from failed migrations without manual database repairs.