# kris-zar/nutritrack-pro architecture

> Architecture diagram of the GitHub repository kris-zar/nutritrack-pro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kris-zar/nutritrack-pro
- Repository: https://github.com/kris-zar/nutritrack-pro

## Overview

NutriTrack PRO is a React nutrition-tracking app backed by a FastAPI REST service. Users enter through the SPA, then view daily calorie and macro totals, configure profile-based targets, browse dated food logs, or log meals manually and optionally analyze a food photo. The backend supports in-memory demo storage or MongoDB persistence, with optional Gemini image analysis. Planner, recipes, progress charts, and fasting are documented as coming soon. The README identifies frontend/ as canonical; backend internals were not excerpted, so backend relationships are limited to documented capabilities and observed API calls.

Main entry points: [`frontend/src/App.js`](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/App.js) (App shell), [`backend/server.py`](https://github.com/kris-zar/nutritrack-pro/blob/main/backend/server.py) (FastAPI service), [`frontend/src/components/LogMeals.js`](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/LogMeals.js) (Meal entry), [`frontend/src/components/Dashboard.js`](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Dashboard.js) (Daily dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Nutrition UI"]
  node_app["App shell<br/>[App.js]"]
  node_dashboard["Daily dashboard<br/>[Dashboard.js]"]
  node_profile["Profile targets<br/>[Profile.js]"]
  node_foods["Food log<br/>[Foods.js]"]
  node_logmeals["Meal entry<br/>[LogMeals.js]"]
  node_future["Planned features<br/>[App.js]"]
end

subgraph group_backend["API and persistence"]
  node_api["FastAPI service<br/>[server.py]"]
  node_storage[("Demo or MongoDB storage<br/>[server.py]")]
end

subgraph group_integrations["External services"]
  node_gemini{{"Gemini analysis"}}
  node_mongodb[("MongoDB")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_foods
node_app -->|"renders"| node_logmeals
node_app -->|"shows placeholders"| node_future
node_app -->|"loads profile"| node_api
node_profile -->|"submits updates"| node_app
node_dashboard -->|"loads stats"| node_api
node_logmeals -->|"posts meals"| node_api
node_logmeals -->|"requests analysis"| node_api
node_api -.->|"reads and writes"| node_storage
node_storage -.->|"persists in production"| node_mongodb
node_api -.->|"analyzes images"| node_gemini

click node_app "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/App.js"
click node_dashboard "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Dashboard.js"
click node_profile "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Profile.js"
click node_foods "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Foods.js"
click node_logmeals "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/LogMeals.js"
click node_future "https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/App.js"
click node_api "https://github.com/kris-zar/nutritrack-pro/blob/main/backend/server.py"
click node_storage "https://github.com/kris-zar/nutritrack-pro/blob/main/backend/server.py"

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_profile,node_foods,node_logmeals,node_future,node_user toneBlue
class node_api,node_storage toneAmber
class node_gemini,node_mongodb toneMint
```

## Components

### Nutrition UI

- [App shell](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Daily dashboard](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Dashboard.js): `frontend/src/components/Dashboard.js`
- [Profile targets](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Profile.js): `frontend/src/components/Profile.js`
- [Food log](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/Foods.js): `frontend/src/components/Foods.js`
- [Meal entry](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/components/LogMeals.js): `frontend/src/components/LogMeals.js`
- [Planned features](https://github.com/kris-zar/nutritrack-pro/blob/main/frontend/src/App.js): `frontend/src/App.js`

### API and persistence

- [FastAPI service](https://github.com/kris-zar/nutritrack-pro/blob/main/backend/server.py): `backend/server.py`
- [Demo or MongoDB storage](https://github.com/kris-zar/nutritrack-pro/blob/main/backend/server.py): `backend/server.py`

### External services

- **Gemini analysis**
- **MongoDB**

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Daily dashboard: renders (evidence: `frontend/src/App.js`)
- App shell → Profile targets: renders (evidence: `frontend/src/App.js`)
- App shell → Food log: renders (evidence: `frontend/src/App.js`)
- App shell → Meal entry: renders (evidence: `frontend/src/App.js`)
- App shell → Planned features: shows placeholders (evidence: `frontend/src/App.js`)
- App shell → FastAPI service: loads profile (evidence: `frontend/src/App.js`)
- Profile targets → App shell: submits updates (evidence: `frontend/src/App.js`)
- Daily dashboard → FastAPI service: loads stats (evidence: `frontend/src/components/Dashboard.js`)
- Meal entry → FastAPI service: posts meals (evidence: `frontend/src/components/LogMeals.js`)
- Meal entry → FastAPI service: requests analysis (evidence: `frontend/src/components/LogMeals.js`)
- FastAPI service → Demo or MongoDB storage: reads and writes (evidence: `README.md`)
- Demo or MongoDB storage → MongoDB: persists in production (evidence: `README.md`)
- FastAPI service → Gemini analysis: analyzes images (evidence: `README.md`)
