How cvjayanth005-sketch/tracker works
Fat Loss Ledger is a local-first fitness and fat-loss PWA. The user signs in, records food, weight, sleep, runs, and workouts, then navigates Today, Progress, Activity, Food, and Plan views. React reads the Dexie working store through dashboard/repository hooks; pure domain rules derive recommendations, trends, compliance, and adaptive training. Changes synchronize as a document with the FastAPI backend, while optional AI services narrate already-decided results. The graph reflects sampled source and README capabilities; some screen wiring was not sampled.
Components 24
User Experience
- App Bootstrap
frontend/src/main.tsx - App Shell
frontend/src/App.tsx - Auth Session
frontend/src/auth/session.ts - Google Login
frontend/src/auth/googleSignIn.ts - Dashboard Read Model
frontend/src/hooks/useDashboard.ts - Today Screen
frontend/src/screens/Today.tsx - Food Screen
frontend/src/screens/Food.tsx - Activity Screen
frontend/src/screens/Activity.tsx - Workout Screen
frontend/src/screens/WorkoutScreen.tsx - Plan Screen
frontend/src/screens/Plan.tsx - Coach Commentary
frontend/src/ai/coachChat.ts
Decision Engine
- Rules Engine
frontend/src/domain/rules.ts - Trend Analytics
frontend/src/domain/trend.ts - Adaptive Training
frontend/src/domain/adaptiveTraining.ts - Adaptive Session
frontend/src/hooks/useAdaptiveSession.ts
Local Data
- IndexedDB Store
frontend/src/db/database.ts - Data Repository
frontend/src/db/repo.ts - Sync Client
frontend/src/sync/client.ts
Sync Backend
- FastAPI Service
backend/app/main.py - Backend Services
backend/app/services.py - SQLite Store
backend/app/database.py
Other components
- User
- Google Sign-In
- AI Provider
Connections 31
- User → App Shell: uses
- App Bootstrap → App Shell: renders
- App Bootstrap → IndexedDB Store: seeds
- App Shell → Auth Session: reads auth
- App Shell → Google Login: starts login
- Google Login → Google Sign-In: authenticates
- Google Login → FastAPI Service: posts credential
- App Shell → Sync Client: starts sync
- App Shell → Today Screen: routes
- App Shell → Food Screen: routes
- App Shell → Activity Screen: routes
- App Shell → Workout Screen: routes
- App Shell → Plan Screen: routes
- Today Screen → Dashboard Read Model: derives view
- Food Screen → Dashboard Read Model: derives view
- Activity Screen → Dashboard Read Model: derives view
- Workout Screen → Dashboard Read Model: derives view
- Plan Screen → Dashboard Read Model: derives view
- Dashboard Read Model → Data Repository: reads records
- Dashboard Read Model → Rules Engine: calculates decisions
- Dashboard Read Model → Trend Analytics: calculates trends
- Activity Screen → Adaptive Session: loads session
- Adaptive Session → Adaptive Training: builds session
- Adaptive Session → Data Repository: starts workout
- Data Repository → IndexedDB Store: reads writes
- Sync Client → IndexedDB Store: merges state
- Sync Client → FastAPI Service: syncs document
- FastAPI Service → Backend Services: dispatches work
- Backend Services → SQLite Store: reads writes
- Coach Commentary → FastAPI Service: requests prose
- Backend Services → AI Provider: narrates summary