# vaibhavpandey-1221/fitness-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/vaibhavpandey-1221/fitness-tracker
- Repository: https://github.com/vaibhavpandey-1221/fitness-tracker

## Overview

FitBot is a fitness and nutrition tracking app. Users authenticate, complete onboarding, then review calorie and activity summaries, log meals and exercise, and manage profile goals; food logging also supports image-based meal analysis. A chat assistant sends fitness questions to a Gemini-backed service. The client has shared app, chat, and theme state, while the server provides API controllers and services. The README is empty, and several route, activity, and persistence implementations were not excerpted, so their internal wiring is not asserted.

Main entry points: [`client/src/App.tsx`](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/App.tsx) (App routing), [`client/src/configs/api.ts`](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/configs/api.ts) (API client), [`client/src/context/AppContext.tsx`](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/AppContext.tsx) (Account and logs), [`client/src/pages/FoodLog.tsx`](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/FoodLog.tsx) (Food logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.tsx]"]
  node_dashboard["Fitness dashboard<br/>[Dashboard.tsx]"]
  node_food["Food logging<br/>[FoodLog.tsx]"]
  node_activity["Activity logging<br/>[ActivityLog.tsx]"]
  node_profile["Profile goals<br/>[Profile.tsx]"]
  node_onboarding["Onboarding<br/>[Onboarding.tsx]"]
  node_login["Authentication UI<br/>[Login.tsx]"]
  node_layout["App layout<br/>[Layout.tsx]"]
  node_chatui["Chat panel<br/>[ChatPanel.tsx]"]
end

subgraph group_state["Client state"]
  node_appstate["Account and logs<br/>[AppContext.tsx]"]
  node_chatstate["Chat state<br/>[ChatContext.tsx]"]
  node_theme["Theme state<br/>[ThemeContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Server APIs"]
  node_strapi[("Strapi backend")]
  node_activity_api["Activity API<br/>[activity-log.ts]"]
  node_food_api["Food API<br/>[food-log.ts]"]
  node_chat_api["Chat controller<br/>[chat.ts]"]
  node_image_api["Image analysis API<br/>[image-analysis.ts]"]
end

subgraph group_ai["AI services"]
  node_gemini_chat["Gemini chat<br/>[gemini-chat.ts]"]
  node_gemini_image["Gemini image analysis<br/>[gemini.ts]"]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}

node_user -->|"uses"| node_app
node_app -->|"routes"| node_login
node_app -->|"routes"| node_onboarding
node_app -->|"routes"| node_layout
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_food
node_app -->|"routes"| node_activity
node_app -->|"routes"| node_profile
node_layout -->|"renders"| node_chatui
node_chatui -->|"uses"| node_chatstate
node_login -->|"uses"| node_appstate
node_onboarding -->|"uses"| node_appstate
node_dashboard -->|"reads logs"| node_appstate
node_food -->|"sends requests"| node_api_client
node_profile -->|"updates profile"| node_api_client
node_appstate -->|"requests data"| node_api_client
node_chatstate -->|"sends messages"| node_api_client
node_api_client -.->|"HTTP requests"| node_strapi
node_food -->|"uploads image"| node_image_api
node_chat_api -->|"delegates"| node_gemini_chat
node_image_api -->|"delegates"| node_gemini_image
node_gemini_chat -->|"generates reply"| node_gemini
node_gemini_image -->|"analyzes image"| node_gemini

click node_app "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/App.tsx"
click node_dashboard "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Dashboard.tsx"
click node_food "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/FoodLog.tsx"
click node_activity "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/ActivityLog.tsx"
click node_profile "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Profile.tsx"
click node_onboarding "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Onboarding.tsx"
click node_login "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Login.tsx"
click node_layout "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Layout.tsx"
click node_chatui "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/components/AIAssistant/ChatPanel.tsx"
click node_appstate "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/AppContext.tsx"
click node_chatstate "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/ChatContext.tsx"
click node_theme "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/ThemeContext.tsx"
click node_api_client "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/configs/api.ts"
click node_activity_api "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/activity-log/controllers/activity-log.ts"
click node_food_api "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/food-log/controllers/food-log.ts"
click node_chat_api "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/chat/controllers/chat.ts"
click node_image_api "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/image-analysis/controllers/image-analysis.ts"
click node_gemini_chat "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/chat/services/gemini-chat.ts"
click node_gemini_image "https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/image-analysis/services/gemini.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_app,node_dashboard,node_food,node_activity,node_profile,node_onboarding,node_login,node_layout,node_chatui,node_user toneBlue
class node_appstate,node_chatstate,node_theme,node_api_client toneAmber
class node_strapi,node_activity_api,node_food_api,node_chat_api,node_image_api toneMint
class node_gemini_chat,node_gemini_image toneRose
class node_gemini toneIndigo
```

## Components

### Client experience

- [App routing](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Fitness dashboard](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Dashboard.tsx): `client/src/pages/Dashboard.tsx`
- [Food logging](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/FoodLog.tsx): `client/src/pages/FoodLog.tsx`
- [Activity logging](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/ActivityLog.tsx): `client/src/pages/ActivityLog.tsx`
- [Profile goals](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Profile.tsx): `client/src/pages/Profile.tsx`
- [Onboarding](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Onboarding.tsx): `client/src/pages/Onboarding.tsx`
- [Authentication UI](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Login.tsx): `client/src/pages/Login.tsx`
- [App layout](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/pages/Layout.tsx): `client/src/pages/Layout.tsx`
- [Chat panel](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/components/AIAssistant/ChatPanel.tsx): `client/src/components/AIAssistant/ChatPanel.tsx`

### Client state

- [Account and logs](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/AppContext.tsx): `client/src/context/AppContext.tsx`
- [Chat state](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/ChatContext.tsx): `client/src/context/ChatContext.tsx`
- [Theme state](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/context/ThemeContext.tsx): `client/src/context/ThemeContext.tsx`
- [API client](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/client/src/configs/api.ts): `client/src/configs/api.ts`

### Server APIs

- **Strapi backend**
- [Activity API](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/activity-log/controllers/activity-log.ts): `server/src/api/activity-log/controllers/activity-log.ts`
- [Food API](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/food-log/controllers/food-log.ts): `server/src/api/food-log/controllers/food-log.ts`
- [Chat controller](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/chat/controllers/chat.ts): `server/src/api/chat/controllers/chat.ts`
- [Image analysis API](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/image-analysis/controllers/image-analysis.ts): `server/src/api/image-analysis/controllers/image-analysis.ts`

### AI services

- [Gemini chat](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/chat/services/gemini-chat.ts): `server/src/api/chat/services/gemini-chat.ts`
- [Gemini image analysis](https://github.com/vaibhavpandey-1221/fitness-tracker/blob/main/server/src/api/image-analysis/services/gemini.ts): `server/src/api/image-analysis/services/gemini.ts`

### Other components

- **User**
- **Google Gemini**

## Connections

- User → App routing: uses
- App routing → Authentication UI: routes (evidence: `client/src/App.tsx`)
- App routing → Onboarding: routes (evidence: `client/src/App.tsx`)
- App routing → App layout: routes (evidence: `client/src/App.tsx`)
- App routing → Fitness dashboard: routes (evidence: `client/src/App.tsx`)
- App routing → Food logging: routes (evidence: `client/src/App.tsx`)
- App routing → Activity logging: routes (evidence: `client/src/App.tsx`)
- App routing → Profile goals: routes (evidence: `client/src/App.tsx`)
- App layout → Chat panel: renders (evidence: `client/src/pages/Layout.tsx`)
- Chat panel → Chat state: uses (evidence: `client/src/components/AIAssistant/ChatPanel.tsx`)
- Authentication UI → Account and logs: uses (evidence: `client/src/pages/Login.tsx`)
- Onboarding → Account and logs: uses (evidence: `client/src/pages/Onboarding.tsx`)
- Fitness dashboard → Account and logs: reads logs (evidence: `client/src/pages/Dashboard.tsx`)
- Food logging → API client: sends requests (evidence: `client/src/pages/FoodLog.tsx`)
- Profile goals → API client: updates profile (evidence: `client/src/pages/Profile.tsx`)
- Account and logs → API client: requests data (evidence: `client/src/context/AppContext.tsx`)
- Chat state → API client: sends messages (evidence: `client/src/context/ChatContext.tsx`)
- API client → Strapi backend: HTTP requests
- Food logging → Image analysis API: uploads image (evidence: `client/src/pages/FoodLog.tsx`)
- Chat controller → Gemini chat: delegates (evidence: `server/src/api/chat/controllers/chat.ts`)
- Image analysis API → Gemini image analysis: delegates (evidence: `server/src/api/image-analysis/controllers/image-analysis.ts`)
- Gemini chat → Google Gemini: generates reply (evidence: `server/src/api/chat/services/gemini-chat.ts`)
- Gemini image analysis → Google Gemini: analyzes image (evidence: `server/src/api/image-analysis/services/gemini.ts`)
