Progress tracking
Tracking progress across all stages.
Timeline overview
- 2025‑09‑15 → 2025‑09‑18: Phase 1 Foundation built. ~24h over 4 days. See costs & time for ongoing tracking.
Stage 1
Foundation for personal coach — 1/11 phases complete.
Phase 1 — Foundation (completed)
Core Infrastructure:
- Strava app + OAuth via ngrok
- Local Postgres running
- Prisma schema (activities, splits)
- Fetch & store activities
- CSV export
- Thumbnails (first pass)
- Details page (AU 24‑hour)
- Prompt frame: Assumptions → Request → Safeguards
- Cost/time logged
Real-time sync:
- Webhook: Strava → <30s arrival — automatic push from Strava to database
- Token refresh service (pre‑expiry window, friendly fail)
- Dedupe on re‑sync (stravaId + time window)
Data model hardening:
- Normalised split schema (no fabrication) — shows real distances like "0.08 km"
- Edit/delete audit trails — complete token and webhook history
- Activity edit/delete with audit flags (user, timestamp, edited flag)
Thumbnails & performance:
- Auto thumbnail generation with map route and km markers
- Background thumbnail worker with retry/cleanup
- Exclude heavy fields from list endpoints
- Sub-50ms API responses (p95 < 50ms achieved)
- 95% reduction in client requests (lazy loading)
UI/UX core:
- Mobile‑first feed optimised for Safari iPhone 14 Pro Max
- Mobile-first dark theme
- Activity filtering (title, type, distance, duration, source, date range)
- Filter persistence (remembered when exiting/returning to app)
- Menu system with activities, statistics, tools, partners sections
- Strava athlete name display at bottom
Admin system:
- 7 admin endpoints: webhooks, activity-jobs, thumbnails, best-efforts, sync-streams, resync
- Admin monitoring APIs for ingest → worker → DB observability
Code quality:
- Fix lint errors for production readiness
- Add documentation sync validation script (npm run docs:check)
- Implement comprehensive code quality tooling (Prettier, ESLint, Husky, lint-staged)
- Set up automated Git hooks for pre-commit quality checks
- Enforce conventional commit message format
- Configure modern ESLint v9 with TypeScript and Next.js rules
- Implement Jest testing framework with React Testing Library
- Set up GitLab CI/CD pipeline with comprehensive quality checks
- Add coverage reporting and quality validation scripts
- Configure automated testing in pre-commit hooks
- Resolve GitLab CI compatibility issues (Node.js 20, native binaries, TailwindCSS v3)
- Implement 5-stage automated pipeline (.pre, validate, test, quality, security)
- Add comprehensive debugging and error handling for CI environment
- Configure Jest with coverage artifacts (JUnit, Cobertura) for GitLab integration
- Set up pre-push hooks to prevent formatting issues reaching CI
- Implement dynamic documentation sync checking with Node.js file operations
Phase 2 — Advanced analytics and best efforts
- GPS-based calculation infrastructure ready
- Automatic best efforts calculation (400m, 800m, 1km, 1mi, 5km, 10km, 21.1km, 42.2km, 50km)
- Activity ranking system for each distance
- Time window filters (week, month, 3 months, year, 2 years, all-time)
- Best efforts page in menu
Phase 3 — Statistics dashboard
- Statistics page (landscape orientation)
- Bar graphs with top buttons: Distance, Duration, Calories, Max Distance, Avg Speed, Altitude
- Time frame buttons: Year, Month, Week, Day
- Dynamic scaling and scrolling for iPhone screen
- Remember last selections (filter + timeframe persistence)
- Filter by activity type (running, walking, cycling for future)
Phase 4 — Activity management
- Activity deletion from database with audit trail
- API endpoint to list differences between database and Strava
- Options to add back: one, several, or all missing activities
- Handle two types: activities not in database, activities modified in Strava
- Activity editing (title, distance, etc.) with audit flags
- Prevent future syncs from overwriting edited records
Phase 5 — UI refinements and components
- Activity count display shows "X activities (Y filtered)" when filtered
- Clear/refresh filter functionality
- Export to CSV from filtered results
- Enhance GUI using shadcn/ui Calendar and Popover components
- Create consistent button-based triggers with icons
- Provide visual feedback for selected states
- Handle empty/invalid states explicitly
Phase 6 — Multi-user auth and permissions
- Unified User model with multi-tenancy
- Create unified User model supporting multiple roles (ADMIN, ATHLETE, COACH)
- Database model relationships: Single source of identity (one record per person)
- UnifiedAuthAdapter for authentication
- Roles and permissions system implemented
- Session management
- Complete user and session CRUD interfaces
Phase 7 — Data import and migration
- Add import tools for batch client/session data (template + validation) from Training Peaks
Phase 8 — Monitoring and alerting
- Background health monitoring and admin views
- Extend health monitoring with alerting and notifications
Phase 9 — Testing and quality
- Write unit tests for utilities
- Add integration tests for components
- Include visual regression tests
- Verify cross-browser compatibility
Phase 10 — Infra and GitOps foundation
- k8s manifests (dev/prod)
- FluxCD wired to GitLab (GitHub mirror)
- Secrets strategy (SOPS/Sealed)
- Backups + tested restore
Phase 11 — Security and reliability
- Auth layer (admin vs user)
- Error taxonomy + helpful messages
- Structured logs + basic alerts
- Data retention knobs
Stage 2: iOS App
Apple HealthKit integration.
- SwiftUI client consuming backend APIs
- Apple HealthKit permissions and sync (read/write)
- User auth flow on mobile
- Native charts and best-efforts display
Stage 3
Health metrics (replace HealthFit, Athlytic, WaterMinder, My Weight).
- Sleep, HRV, RHR, oxygen saturation ingestion
- Recovery, exertion, hydration logging
- Weight tracking and graphing
- Rolling sleep debt and consistency metrics
Stage 4: Nutrition basics
Replace MyFitnessPal for simple use.
- Manual food entry (calories, sugar)
- Daily and weekly summaries
- Export to CSV/JSON
Stage 5: Apple watch app
Replace NRC + Strava.
- Native run tracking (distance, pace, HR, GPS)
- Music track logging during runs
- Guided workouts
- Offline sync to backend
Open decisions
- Whether to backfill full TP history now or later
- Image storage path (NFS vs S3‑compatible)
- Stats/graphing lib for web (keep it light)
Risks and mitigations
- AI edits can break code → lock Cursor to Claude 4 Sonnet; manual apply only; backups on.
- Strava rate limits → throttle jobs, exponential backoff, diff‑based re‑ingest.
- K8s complexity → start minimal, GitOps everything, test restores weekly.
Costs
- See costs & time for ongoing tracking.
Recent improvements (stage 1 MVP)
Advanced sync filters
- Smart filter interface - click "Sync Activities" to access comprehensive sync options.
- Date range filtering - sync only activities within specific time periods using date pickers.
- Quick action buttons - "Sync New" or "Force Update All" in one click
- Configurable thresholds - adjust early termination from 5 to 999+ activities.
- Activity limits - control processing volume from 50 to 1000 activities per sync.
- Force update option - reprocess existing activities with latest Strava data.
- Accessibility improvements - proper form labels, IDs, and screen reader compatibility.
- Visual consistency - grouped controls, consistent spacing, and rounded button styling.
Automatic activity import
- Fully automated sync - activities import automatically every 4 hours.
- Set it and forget it - no more manual "sync" button clicks needed.
- Configurable thresholds - customise auto-sync behaviour via environment variables.
- Intelligent early termination - stops processing when no new activities found.
- Complete activity data - imports splits, thumbnails, and performance metrics automatically.
Database-first authentication architecture
- Pure PostgreSQL storage - 100% database-first token management with zero file dependencies.
- Automatic token refresh - database-managed refresh with comprehensive audit trail.
- Legacy code eliminated - removed 300+ lines of file-based fallback code for cleaner architecture.
- Multi-user foundation - unique athlete IDs ready for future user expansion.
- Cross-device reliability - database persistence works across all devices and browsers.
- Performance optimised - direct database queries, no file I/O blocking.
- Simplified codebase - single authentication code path, easier maintenance.
Mobile-first UI optimisation
- Mobile-optimised design - dark theme with professional card layouts and navigation.
- Full-width activity cards - maximises screen real estate usage.
- Reduced vertical spacing - fits more activities on screen (3x improvement in density).
- One-tap navigation - entire activity row is clickable for instant access to details.
- Streamlined content - removed average HR and running icons for cleaner appearance.
- Compact thumbnails - optimised 56x56px size with proper aspect ratio.
- Better spacing hierarchy - consistent padding and margins throughout.
Enterprise-grade audit trail (September 2025)
- Complete token history - maintains full audit trail of all Strava authentication events.
- Security compliance - tracks token creation, refresh, and revocation timestamps.
- Usage analytics - comprehensive connection patterns and authentication lifecycle data.
- Soft deletion - preserves historical records instead of permanent deletion for compliance.
- Multi-record per athlete - supports multiple token records per user with
isActiveflag. - Seamless migration - removed unique constraints to enable audit trail without breaking existing functionality.
- Database optimisation - efficient queries with
[athleteId, isActive]composite indexing. - Enhanced security - complete visibility into authentication events for security auditing.
Major performance optimisation (September 2025)
- 95% reduction in initial HTTP requests - eliminated 40+ unnecessary map requests on page load.
- Lazy loading implementation - thumbnails load only when visible using Intersection Observer API.
- Progressive image loading - 50px preload margin with smart viewport detection.
- Instant page loads - 411ms DOM ready time, 998ms full load (down from several seconds).
- Efficient bandwidth usage - 3MB total transfer for 50 activities (was 10MB+ previously).
- Smart request prioritisation - core app loads first, images load as user scrolls.
- Memory optimisation - automatic observer cleanup prevents memory leaks.
- Mobile performance boost - particularly benefits slow mobile connections.
Enhanced splits system
- Database schema extension - normalised split storage with real distance/duration fields.
- Accurate partial splits - displays true values like "0.08 km" and "0:38" for final laps.
- Full-page splits view - dedicated
/activities/[id]/splitspage with professional table layout. - Improved column structure - Lap, Distance (km), Duration (min:sec), Pace (min/km), HR (bpm).
- Centered headers with units - clean typography with units displayed in subheaders.
- Larger data rows - 18px font size for better readability on mobile devices.
- Database migration completed - 47 activities backfilled with accurate split data.
- API optimisation - direct database queries instead of raw JSON parsing.
- Target infra run‑rate: <$20/mo self‑hosted.