# dayumcodes/calorie-tracker architecture

> Architecture diagram of the GitHub repository dayumcodes/calorie-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dayumcodes/calorie-tracker
- Repository: https://github.com/dayumcodes/calorie-tracker

## Overview

Calorie Tracker is a nutrition-tracking web app: users set up a profile and goals, record meals, then review daily intake and progress. AI food analysis and personalized insights support that loop; separate features generate diet plans and manage reminders. The README describes local persistence, while the sampled notification routes explicitly use Supabase for subscriptions. Some page and hook implementations were not sampled, so uncertain internal wiring is omitted.

Main entry points: [`src/app/page.tsx`](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/page.tsx) (Dashboard), [`src/app/api/notifications/send/route.ts`](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/api/notifications/send/route.ts) (Notification API), [`src/app/log-food/manual/page.tsx`](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/manual/page.tsx) (Manual Logging), [`src/app/log-food/photo/page.tsx`](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/photo/page.tsx) (Photo Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tracking["Food Tracking"]
  node_home["Dashboard<br/>[page.tsx]"]
  node_manual["Manual Logging<br/>[page.tsx]"]
  node_photo["Photo Logging<br/>[page.tsx]"]
  node_barcode["Barcode Logging<br/>[page.tsx]"]
  node_textai["Food Text Analysis"]
  node_photoai["Food Photo Analysis"]
  node_dailylog["Daily Log State<br/>[use-daily-log.ts]"]
  node_insights["Smart Insights<br/>[smart-insights.tsx]"]
end

subgraph group_personalization["Plans And Progress"]
  node_onboarding["Onboarding<br/>[page.tsx]"]
  node_profile["Profile State"]
  node_goals["Goal Tracking<br/>[use-goals.ts]"]
  node_progress["Progress View<br/>[page.tsx]"]
  node_diet["Diet Chart<br/>[page.tsx]"]
  node_indianchart["Indian Diet Generator"]
end

subgraph group_account["Accounts And State"]
  node_auth["Authentication<br/>[auth-form.tsx]"]
  node_supabaseclient["Supabase Client<br/>[client.ts]"]
end

subgraph group_reminders["Reminders"]
  node_reminderpage["Reminder Settings<br/>[page.tsx]"]
  node_remindersettings["Reminder State"]
  node_subscribe["Subscription API<br/>[route.ts]"]
  node_send["Notification API<br/>[route.ts]"]
  node_worker["Push Service Worker<br/>[service-worker.js]"]
end

subgraph group_content["Health Content"]
  node_blog["Nutrition Articles<br/>[page.tsx]"]
  node_articledata["Article Content<br/>[blog-content.ts]"]
end

node_user(("User"))
node_supabase[("Supabase")]
node_webpush["Web Push Service"]

node_user -->|"views"| node_home
node_user -->|"logs meals"| node_manual
node_user -->|"submits photo"| node_photo
node_user -->|"scans food"| node_barcode
node_manual -->|"analyzes text"| node_textai
node_photo -->|"analyzes photo"| node_photoai
node_home -->|"reads log"| node_dailylog
node_insights -->|"reads patterns"| node_dailylog
node_user -->|"sets up profile"| node_onboarding
node_onboarding -->|"updates profile"| node_profile
node_home -->|"shows targets"| node_goals
node_user -->|"reviews progress"| node_progress
node_user -->|"requests plan"| node_diet
node_diet -->|"generates chart"| node_indianchart
node_user -->|"signs in"| node_auth
node_auth -->|"calls auth"| node_supabaseclient
node_supabaseclient -->|"authenticates"| node_supabase
node_user -->|"configures reminders"| node_reminderpage
node_reminderpage -->|"uses settings"| node_remindersettings
node_subscribe -->|"stores subscription"| node_supabase
node_send -->|"reads subscriptions"| node_supabase
node_send -->|"sends push"| node_webpush
node_webpush -->|"delivers push"| node_worker
node_worker -->|"shows notification"| node_user
node_user -->|"reads articles"| node_blog
node_blog -->|"loads content"| node_articledata

click node_home "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/page.tsx"
click node_manual "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/manual/page.tsx"
click node_photo "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/photo/page.tsx"
click node_barcode "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/barcode/page.tsx"
click node_textai "https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/analyze-food-text-flow.ts"
click node_photoai "https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/analyze-food-photo.ts"
click node_dailylog "https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-daily-log.ts"
click node_insights "https://github.com/dayumcodes/calorie-tracker/blob/master/src/components/dashboard/smart-insights.tsx"
click node_onboarding "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/onboarding/page.tsx"
click node_profile "https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-user-profile.ts"
click node_goals "https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-goals.ts"
click node_progress "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/progress/page.tsx"
click node_diet "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/diet-chart/page.tsx"
click node_indianchart "https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/generateIndianDietChartFlow.ts"
click node_auth "https://github.com/dayumcodes/calorie-tracker/blob/master/src/components/auth/auth-form.tsx"
click node_supabaseclient "https://github.com/dayumcodes/calorie-tracker/blob/master/src/lib/supabase/client.ts"
click node_reminderpage "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/reminders/page.tsx"
click node_remindersettings "https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-reminder-settings.ts"
click node_subscribe "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/api/notifications/subscribe/route.ts"
click node_send "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/api/notifications/send/route.ts"
click node_worker "https://github.com/dayumcodes/calorie-tracker/blob/master/public/service-worker.js"
click node_blog "https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/blog/page.tsx"
click node_articledata "https://github.com/dayumcodes/calorie-tracker/blob/master/src/data/blog-content.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_manual,node_photo,node_barcode,node_textai,node_photoai,node_dailylog,node_insights,node_user toneBlue
class node_onboarding,node_profile,node_goals,node_progress,node_diet,node_indianchart,node_supabase toneAmber
class node_auth,node_supabaseclient toneMint
class node_reminderpage,node_remindersettings,node_subscribe,node_send,node_worker toneRose
class node_blog,node_articledata,node_webpush toneIndigo
```

## Components

### Food Tracking

- [Dashboard](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/page.tsx): `src/app/page.tsx`
- [Manual Logging](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/manual/page.tsx): `src/app/log-food/manual/page.tsx`
- [Photo Logging](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/photo/page.tsx): `src/app/log-food/photo/page.tsx`
- [Barcode Logging](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/log-food/barcode/page.tsx): `src/app/log-food/barcode/page.tsx`
- [Food Text Analysis](https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/analyze-food-text-flow.ts): `src/ai/flows/analyze-food-text-flow.ts`
- [Food Photo Analysis](https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/analyze-food-photo.ts): `src/ai/flows/analyze-food-photo.ts`
- [Daily Log State](https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-daily-log.ts): `src/hooks/use-daily-log.ts`
- [Smart Insights](https://github.com/dayumcodes/calorie-tracker/blob/master/src/components/dashboard/smart-insights.tsx): `src/components/dashboard/smart-insights.tsx`

### Plans And Progress

- [Onboarding](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/onboarding/page.tsx): `src/app/onboarding/page.tsx`
- [Profile State](https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-user-profile.ts): `src/hooks/use-user-profile.ts`
- [Goal Tracking](https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-goals.ts): `src/hooks/use-goals.ts`
- [Progress View](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/progress/page.tsx): `src/app/progress/page.tsx`
- [Diet Chart](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/diet-chart/page.tsx): `src/app/diet-chart/page.tsx`
- [Indian Diet Generator](https://github.com/dayumcodes/calorie-tracker/blob/master/src/ai/flows/generateIndianDietChartFlow.ts): `src/ai/flows/generateIndianDietChartFlow.ts`

### Accounts And State

- [Authentication](https://github.com/dayumcodes/calorie-tracker/blob/master/src/components/auth/auth-form.tsx): `src/components/auth/auth-form.tsx`
- [Supabase Client](https://github.com/dayumcodes/calorie-tracker/blob/master/src/lib/supabase/client.ts): `src/lib/supabase/client.ts`

### Reminders

- [Reminder Settings](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/reminders/page.tsx): `src/app/reminders/page.tsx`
- [Reminder State](https://github.com/dayumcodes/calorie-tracker/blob/master/src/hooks/use-reminder-settings.ts): `src/hooks/use-reminder-settings.ts`
- [Subscription API](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/api/notifications/subscribe/route.ts): `src/app/api/notifications/subscribe/route.ts`
- [Notification API](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/api/notifications/send/route.ts): `src/app/api/notifications/send/route.ts`
- [Push Service Worker](https://github.com/dayumcodes/calorie-tracker/blob/master/public/service-worker.js): `public/service-worker.js`

### Health Content

- [Nutrition Articles](https://github.com/dayumcodes/calorie-tracker/blob/master/src/app/blog/page.tsx): `src/app/blog/page.tsx`
- [Article Content](https://github.com/dayumcodes/calorie-tracker/blob/master/src/data/blog-content.ts): `src/data/blog-content.ts`

### Other components

- **User**
- **Supabase**
- **Web Push Service**

## Connections

- User → Dashboard: views
- User → Manual Logging: logs meals
- User → Photo Logging: submits photo
- User → Barcode Logging: scans food
- Manual Logging → Food Text Analysis: analyzes text
- Photo Logging → Food Photo Analysis: analyzes photo
- Dashboard → Daily Log State: reads log
- Smart Insights → Daily Log State: reads patterns
- User → Onboarding: sets up profile
- Onboarding → Profile State: updates profile
- Dashboard → Goal Tracking: shows targets
- User → Progress View: reviews progress
- User → Diet Chart: requests plan
- Diet Chart → Indian Diet Generator: generates chart
- User → Authentication: signs in
- Authentication → Supabase Client: calls auth
- Supabase Client → Supabase: authenticates
- User → Reminder Settings: configures reminders
- Reminder Settings → Reminder State: uses settings
- Subscription API → Supabase: stores subscription
- Notification API → Supabase: reads subscriptions
- Notification API → Web Push Service: sends push
- Web Push Service → Push Service Worker: delivers push
- Push Service Worker → User: shows notification
- User → Nutrition Articles: reads articles
- Nutrition Articles → Article Content: loads content
