How r1demachine/endurance-fantasy-league works
Endurance Fantasy League turns athletes’ training and wellness data into XP, levels, and social competition. The main workflow is account access, connecting an Intervals.icu account, syncing training data, calculating progression, then viewing it in the dashboard; friends and live notifications form a parallel social branch. Backend call relationships are grounded in the excerpts and SOURCE INDEX. Frontend-to-API wiring was not shown, so those links are marked unverified.
Main entry points: main.py FastAPI application · sync.py Training sync and profile · models.py Domain records · dependencies.py User authentication
Components 27
Athlete app
- Login and registration
frontend/src/app/login/page.tsx - Training dashboard
frontend/src/app/dashboard/page.tsx - Activity details
frontend/src/components/ActivityCard.tsx - Connect sources
frontend/src/components/ConnectSources.tsx - Athlete profile
frontend/src/app/profile/page.tsx - Friends hub
frontend/src/components/SocialHub.tsx - Notification bell
frontend/src/components/NotificationBell.tsx - Route guard
frontend/src/components/AuthGuard.tsx - API cache
frontend/src/lib/apiCache.ts
API and identity
- FastAPI application
backend/app/main.py - Account endpoints
backend/app/routers/auth.py - Token and secrets
backend/app/auth.py - User authentication
backend/app/dependencies.py - Application settings
backend/app/config.py - Domain records
backend/app/models.py - Relational database
backend/app/database.py - Admin endpoints
backend/app/routers/admin.py
Training progression
- Training sync and profile
backend/app/routers/sync.py - Intervals.icu client
backend/app/services/intervals.py - XP and levels
backend/app/services/xp.py - Connect API key
backend/app/routers/intervals_key.py
Social features
- Friend requests
backend/app/routers/friends.py - Notification endpoints
backend/app/routers/notifications.py - Notification delivery
backend/app/services/notifications.py - Live event broker
backend/app/broker.py
Other components
- Athlete
- Intervals.icu
Connections 36
- Athlete → Login and registration: signs in
- Athlete → Training dashboard: views progress
- Athlete → Athlete profile: views profile
- Athlete → Friends hub: competes socially
- Training dashboard → Training sync and profile: requests training data
- Connect sources → Connect API key: sets API key
- Friends hub → Friend requests: uses friends API
- Notification bell → Notification endpoints: uses notification API
- FastAPI application → Training sync and profile: registers routes
backend/app/main.py - FastAPI application → Account endpoints: registers routes
backend/app/main.py - FastAPI application → Connect API key: registers routes
backend/app/main.py - FastAPI application → Friend requests: registers routes
backend/app/main.py - FastAPI application → Notification endpoints: registers routes
backend/app/main.py - FastAPI application → Admin endpoints: registers routes
backend/app/main.py - FastAPI application → Relational database: creates schema
backend/app/main.py - FastAPI application → Live event broker: initializes
backend/app/main.py - Relational database → Application settings: loads settings
backend/app/database.py - Domain records → Relational database: uses base
backend/app/models.py - User authentication → Relational database: gets session
backend/app/dependencies.py - User authentication → Domain records: loads user
backend/app/dependencies.py - User authentication → Token and secrets: decodes token
backend/app/dependencies.py - Account endpoints → Domain records: queries users
backend/app/routers/auth.py - Account endpoints → Token and secrets: hashes and issues tokens
backend/app/routers/auth.py - Account endpoints → User authentication: guards current user
backend/app/routers/auth.py - Training sync and profile → User authentication: requires user
backend/app/routers/sync.py - Training sync and profile → Domain records: reads and writes records
backend/app/routers/sync.py - Training sync and profile → XP and levels: recalculates progression
backend/app/routers/sync.py - Training sync and profile → Intervals.icu client: fetches training data
backend/app/routers/sync.py - Intervals.icu client → Intervals.icu: requests activity and wellness data
backend/app/services/intervals.py - Connect API key → Intervals.icu client: validates credentials
backend/app/routers/intervals_key.py - Connect API key → Token and secrets: encrypts API key
backend/app/routers/intervals_key.py - Friend requests → Domain records: queries friendships
backend/app/routers/friends.py - Friend requests → Notification delivery: notifies accepted friend
backend/app/routers/friends.py - Notification delivery → Domain records: stores notification
backend/app/services/notifications.py - Notification delivery → Live event broker: publishes event
backend/app/services/notifications.py - Notification endpoints → Live event broker: subscribes to events
backend/app/routers/notifications.py