How dhruvg130/calorie-app works
Calorie Tracker is a mobile nutrition and recovery app. The main flow is authenticate, choose a logging route, find or enter food, confirm servings and meal type, then save and review daily intake. Weight tracking and WHOOP-derived recovery are separate but related capabilities. The graph preserves those documented branches; source excerpts support only some client and backend links, so unsampled relationships are not asserted.
Main entry points: add.tsx Add food routes · index.ts Nutrition lookup · ServingForm.tsx Serving and meal form · supabase.ts Supabase client
Components 31
Mobile experience
- Sign-in and sign-up
app/(auth)/sign-in.tsx - Session and auth
src/providers/AuthProvider.tsx - Today dashboard
app/(tabs)/index.tsx
Nutrition logging
- Add food routes
app/(tabs)/add.tsx - Food search
app/log/search.tsx - Barcode lookup
app/log/scan.tsx - Photo logging
app/log/photo.tsx - Manual entry
app/log/manual.tsx - Confirm food
app/log/confirm.tsx - Food handoff
src/services/nutrition/handoff.ts - Nutrition lookup
src/services/nutrition/index.ts - Serving and meal form
src/components/ServingForm.tsx
Personal tracking
- Entry queries
src/hooks/useEntries.ts - Entry persistence
src/api/entries.ts - Profile queries
src/hooks/useProfile.ts - Weight tracking
app/(tabs)/weight.tsx - Weight persistence
src/api/weight.ts - WHOOP dashboard
app/(tabs)/whoop.tsx - WHOOP queries
src/hooks/useWhoop.ts - WHOOP client API
src/api/whoop.ts
Supabase services
- Food search function
supabase/functions/food-search/index.ts - USDA search function
supabase/functions/usda-search/index.ts - Open Food Facts
src/services/nutrition/openFoodFacts.ts - WHOOP function
supabase/functions/whoop/index.ts - OAuth callback
supabase/functions/whoop-callback/index.ts - PostgreSQL data
src/lib/database.types.ts - Supabase client
src/lib/supabase.ts
Other components
- User
- WHOOP service
- Open Food Facts service
- USDA service
Connections 36
- User → Sign-in and sign-up: signs in
- Sign-in and sign-up → Session and auth: submits credentials
- Session and auth → Supabase client: authenticates
src/providers/AuthProvider.tsx - Today dashboard → Entry queries: loads entries
app/(tabs)/index.tsx - Today dashboard → Profile queries: loads goals
app/(tabs)/index.tsx - User → Add food routes: starts logging
- Add food routes → Food search: opens search
- Add food routes → Barcode lookup: opens scanner
- Add food routes → Photo logging: opens camera
- Add food routes → Manual entry: opens manual
- Food search → Nutrition lookup: searches foods
app/log/search.tsx - Barcode lookup → Nutrition lookup: looks up barcode
app/log/scan.tsx - Food search → Food handoff: passes selection
app/log/search.tsx - Barcode lookup → Food handoff: passes selection
app/log/scan.tsx - Nutrition lookup → Food search function: searches remotely
- Nutrition lookup → Open Food Facts: queries barcode
src/services/nutrition/index.ts - Food search function → USDA service: queries USDA
- Food search function → Open Food Facts service: queries products
- User → Confirm food: confirms selection
- Confirm food → Serving and meal form: sets serving
- Manual entry → Serving and meal form: enters food
- Photo logging → Serving and meal form: reviews food
- Serving and meal form → Entry queries: creates entry
- Entry queries → Entry persistence: calls persistence
src/hooks/useEntries.ts - Entry persistence → Supabase client: reads and writes
src/api/entries.ts - Supabase client → PostgreSQL data: queries data
src/lib/supabase.ts - User → Weight tracking: records weight
- Weight tracking → Weight persistence: loads and saves
app/(tabs)/weight.tsx - Weight persistence → Supabase client: reads and writes
src/api/weight.ts - User → WHOOP dashboard: views recovery
- WHOOP dashboard → WHOOP queries: loads metrics
- WHOOP queries → WHOOP client API: requests data
src/hooks/useWhoop.ts - WHOOP client API → WHOOP function: calls function
- WHOOP function → WHOOP service: fetches metrics
- OAuth callback → WHOOP service: exchanges code
- WHOOP function → PostgreSQL data: stores metrics