# dozenbro/group13-smart-nutrition-fitness architecture

> Architecture diagram of the GitHub repository dozenbro/group13-smart-nutrition-fitness, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dozenbro/group13-smart-nutrition-fitness
- Repository: https://github.com/dozenbro/group13-smart-nutrition-fitness

## Overview

The current product is a shared-history web demo for recording weight and height, calculating BMI, and reviewing recent measurements. A user enters a measurement in the React interface; FastAPI validates and saves it, calculates BMI, and returns it for display. Reloading history requests saved records. PostgreSQL persistence and schema versioning are documented. TDEE calculation exists internally but is not exposed by the API. Accounts, workouts, and meal suggestions are roadmap capabilities, not implemented workflows; their source implementation is therefore not represented. Unsampled roadmap details are limited to the README’s stated scope.

Main entry points: [`backend/main.py`](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/main.py) (Measurement endpoints), [`frontend/src/main.jsx`](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/frontend/src/main.jsx) (Measurement interface), [`backend/database.py`](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/database.py) (Database sessions), [`docs/sprints/SPRINT_2.md`](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_2.md) (Workout plans)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interface"]
  node_ui["Measurement interface<br/>[main.jsx]"]
end

subgraph group_measurement["Measurement API"]
  node_api["Measurement endpoints<br/>[main.py]"]
  node_health["BMI and TDEE logic<br/>[health.py]"]
end

subgraph group_persistence["Persistence"]
  node_model["Measurement model<br/>[models.py]"]
  node_session["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_schema["Schema migrations"]
end

subgraph group_roadmap["Planned capabilities"]
  node_accounts["Accounts and profiles<br/>[SPRINT_1.md]"]
  node_workouts["Workout plans<br/>[SPRINT_2.md]"]
  node_meals["Meals and suggestions<br/>[SPRINT_3.md]"]
end

node_user(("User"))

node_user -->|"enters measurements"| node_ui
node_ui -->|"requests API"| node_api
node_api -->|"gets session"| node_session
node_api -->|"queries and saves"| node_model
node_api -->|"calculates BMI"| node_health
node_session -->|"reads and writes"| node_postgres
node_schema -->|"versions schema"| node_postgres
node_accounts -.-> node_workouts
node_workouts -.-> node_meals

click node_ui "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/frontend/src/main.jsx"
click node_api "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/main.py"
click node_health "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/health.py"
click node_model "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/models.py"
click node_session "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/database.py"
click node_schema "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/migrations/versions/001_measurements.py"
click node_accounts "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_1.md"
click node_workouts "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_2.md"
click node_meals "https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_3.md"

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_ui,node_user toneBlue
class node_api,node_health toneAmber
class node_model,node_session,node_postgres,node_schema toneMint
class node_accounts,node_workouts,node_meals toneRose
```

## Components

### User interface

- [Measurement interface](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### Measurement API

- [Measurement endpoints](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/main.py): `backend/main.py`
- [BMI and TDEE logic](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/health.py): `backend/health.py`

### Persistence

- [Measurement model](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/models.py): `backend/models.py`
- [Database sessions](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/backend/database.py): `backend/database.py`
- **PostgreSQL**
- [Schema migrations](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/migrations/versions/001_measurements.py): `migrations/versions/001_measurements.py`

### Planned capabilities

- [Accounts and profiles](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_1.md): `docs/sprints/SPRINT_1.md`
- [Workout plans](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_2.md): `docs/sprints/SPRINT_2.md`
- [Meals and suggestions](https://github.com/dozenbro/group13-smart-nutrition-fitness/blob/main/docs/sprints/SPRINT_3.md): `docs/sprints/SPRINT_3.md`

### Other components

- **User**

## Connections

- User → Measurement interface: enters measurements (evidence: `frontend/src/main.jsx`)
- Measurement interface → Measurement endpoints: requests API (evidence: `frontend/src/main.jsx`)
- Measurement endpoints → Database sessions: gets session (evidence: `backend/main.py`)
- Measurement endpoints → Measurement model: queries and saves (evidence: `backend/main.py`)
- Measurement endpoints → BMI and TDEE logic: calculates BMI (evidence: `backend/main.py`)
- Database sessions → PostgreSQL: reads and writes (evidence: `README.md`)
- Schema migrations → PostgreSQL: versions schema (evidence: `README.md`)
- Accounts and profiles → Workout plans
- Workout plans → Meals and suggestions
