How bhumii23/cal-ai works
Cal AI is a nutrition-tracking web app. Users authenticate, review a dashboard, log meals (including a photo-analysis workflow), and manage nutrition goals and profile settings; history provides a separate tracking view. Authentication and nutrition data use Supabase when configured, with local-storage fallback for app data. The major unsampled pages and analysis endpoint are represented from the tree, but their internal calls are not inferred. The README is a generic Next.js starter and documents no additional product capabilities.
Main entry points: db.ts Nutrition data · auth.ts Auth logic · auth/page.tsx Sign in · profile/page.tsx Profile settings
Components 15
User experience
- Sign in
src/app/auth/page.tsx - Dashboard
src/app/page.tsx - Profile settings
src/app/profile/page.tsx
Nutrition workflows
- Food diary
src/app/diary/page.tsx - Meal analysis
src/app/api/analyze/route.ts - Nutrition history
src/app/history/page.tsx - Goal tracking
src/app/goals/page.tsx
Identity and persistence
- Auth logic
src/lib/auth.ts - Route auth gate
middleware.ts - Nutrition data
src/lib/db.ts - Supabase client
src/lib/supabaseClient.ts
External services
- Browser storage
- Supabase
- AI analysis provider
Other components
- User
Connections 24
- User → Sign in: signs in
src/app/auth/page.tsx - User → Dashboard: tracks nutrition
src/app/page.tsx - User → Food diary: logs meals
src/app/diary/page.tsx - User → Nutrition history: reviews history
- User → Goal tracking: sets goals
- User → Profile settings: edits profile
src/app/profile/page.tsx - Sign in → Auth logic: calls auth
src/app/auth/page.tsx - Sign in → Supabase client: checks setup
src/app/auth/page.tsx - Route auth gate → Supabase: checks session
middleware.ts - Dashboard → Nutrition data: loads and adds
src/app/page.tsx - Food diary → Nutrition data: loads and edits
src/app/diary/page.tsx - Profile settings → Auth logic: reads and updates
src/app/profile/page.tsx - Profile settings → Nutrition data: loads and saves
src/app/profile/page.tsx - Nutrition history → Nutrition data: loads nutrition data
- Goal tracking → Nutrition data: loads and saves goals
- Food diary → Meal analysis: requests analysis
- Meal analysis → AI analysis provider: requests estimates
- Auth logic → Supabase client: creates client
src/lib/auth.ts - Nutrition data → Auth logic: gets session scope
src/lib/db.ts - Nutrition data → Supabase client: creates client
src/lib/db.ts - Auth logic → Browser storage: stores fallback auth
src/lib/auth.ts - Nutrition data → Browser storage: stores fallback data
src/lib/db.ts - Auth logic → Supabase: uses auth
src/lib/auth.ts - Nutrition data → Supabase: reads and writes
src/lib/db.ts