How khalilshakra/calora works
Calora is a food, nutrition, and habit-tracking app, with local-first use and optional Supabase accounts and cloud sync. The user-facing flow covers onboarding and goal planning, daily food and water tracking, progress and rewards, and account settings. Food can also be scanned or looked up by barcode. The excerpts show the action layer coordinating local persistence, rewards, and sync; several UI modules and the barcode route were not sampled, so their runtime connections are not asserted.
Main entry points: actions.ts Domain actions · Dashboard.tsx Daily dashboard · session.ts Auth session · OnboardingWizard.tsx Onboarding
Components 31
App experience
- Onboarding
components/onboarding/OnboardingWizard.tsx - Daily dashboard
components/dashboard/Dashboard.tsx
Nutrition tracking
- Meal logger
components/logger/Logger.tsx - Food scanner
components/scan/ScanStudio.tsx - Food analysis API
app/api/analyze-food/route.ts - Vision analysis
lib/ai/vision.ts - Barcode API
app/api/barcode/route.ts
Goals and progress
- Progress view
components/progress/ProgressView.tsx - Tips feed
components/tips/TipsFeed.tsx - Tip content
lib/tips.ts
Accounts and sync
- Settings
components/settings/SettingsView.tsx - Auth screen
components/auth/AuthScreen.tsx - Auth session
lib/auth/session.ts - Local identity migration
lib/auth/identity.ts - Cloud sync
lib/sync/cloud.ts - Supabase client
lib/supabase/client.ts
Shared runtime
- Domain actions
lib/actions.ts - Local database
lib/db/index.ts - Active goal hook
hooks/useActiveGoal.ts - Rewards logic
lib/rewards.ts - Plan calculations
lib/tdee.ts - Auth state
store/useAuth.ts - Language state
store/useLang.ts - Translations
lib/i18n.ts - UI state
store/useUi.ts - UI primitives
components/ui.tsx - Number field
components/ui/NumberField.tsx - Brand tokens
design/brand.ts - Achievement catalog
lib/achievements.ts
Other components
- User
- Supabase service
Connections 36
- User → Onboarding: sets plan
- Onboarding → Domain actions: saves profile
components/onboarding/OnboardingWizard.tsx - Domain actions → Plan calculations: calculates targets
lib/actions.ts - Domain actions → Local database: writes records
lib/actions.ts - Domain actions → Rewards logic: awards progress
lib/actions.ts - Domain actions → Cloud sync: schedules sync
lib/actions.ts - User → Daily dashboard: tracks day
- Daily dashboard → Domain actions: loads and updates
components/dashboard/Dashboard.tsx - Daily dashboard → Active goal hook: reads active goal
components/dashboard/Dashboard.tsx - Active goal hook → Local database: queries goal
hooks/useActiveGoal.ts - User → Meal logger: logs meals
- Meal logger → Domain actions: records entries
- User → Food scanner: scans food
- Food scanner → Domain actions: adds scan result
components/scan/ScanStudio.tsx - Food analysis API → Vision analysis: invokes analysis
app/api/analyze-food/route.ts - User → Progress view: reviews progress
- Progress view → Domain actions: loads progress
components/progress/ProgressView.tsx - User → Tips feed: opens tips
- Tips feed → Tip content: loads guidance
components/tips/TipsFeed.tsx - User → Settings: manages account
- Settings → Domain actions: updates profile
components/settings/SettingsView.tsx - User → Auth screen: signs in
- Auth screen → Auth session: uses session
components/auth/AuthScreen.tsx - Auth session → Local identity migration: migrates local data
lib/auth/session.ts - Auth session → Cloud sync: hydrates account
lib/auth/session.ts - Auth session → Supabase client: checks session
lib/auth/session.ts - Auth session → Auth state: updates auth state
lib/auth/session.ts - Cloud sync → Local database: reads and writes
lib/sync/cloud.ts - Cloud sync → Supabase client: uses client
lib/sync/cloud.ts - Supabase client → Supabase service: connects
- Daily dashboard → Translations: translates labels
components/dashboard/Dashboard.tsx - Tips feed → Translations: translates content
components/tips/TipsFeed.tsx - Onboarding → UI primitives: renders controls
components/onboarding/OnboardingWizard.tsx - Onboarding → Number field: renders fields
components/onboarding/OnboardingWizard.tsx - Daily dashboard → Brand tokens: uses visual tokens
components/dashboard/Dashboard.tsx - Domain actions → Achievement catalog: seeds catalog
lib/actions.ts