# coopermay/fitness-tracker architecture

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

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

## Overview

Fitness Tracker is a single-user workout logging and progress app. The main workflow is to select a lift, log sets with machine and weight details, then review per-weight records and history; Today, Calendar, plateau insights, weekly split, and settings provide supporting views. The graph combines sampled source with README capabilities and SOURCE INDEX references; unsampled router implementations are grouped by their exact directory, so their internal behavior is not expanded.

Main entry points: [`frontend/src/App.tsx`](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/App.tsx) (Routes and screens), [`frontend/src/api/queries.ts`](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/api/queries.ts) (Query hooks), [`backend/app/calendar.py`](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/calendar.py) (Calendar aggregation), [`backend/app/routers`](https://github.com/coopermay/fitness-tracker/tree/main/backend/app/routers) (Resource endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workout interface"]
  node_app["Routes and screens<br/>[App.tsx]"]
  node_setui["Set logging<br/>[SetForm.tsx]"]
  node_liftui["Lift records<br/>[LiftPage.tsx]"]
  node_todayui["Today plan<br/>[TodayPage.tsx]"]
  node_calendarui["Workout calendar<br/>[CalendarPage.tsx]"]
  node_settingsui["Settings and split<br/>[SettingsPage.tsx]"]
  node_query["Query hooks<br/>[queries.ts]"]
  node_clientapi["HTTP client<br/>[client.ts]"]
end

subgraph group_api["Application API"]
  node_fastapi["API registration<br/>[main.py]"]
  node_routers["Resource endpoints"]
  node_todayroute["Today endpoint<br/>[today.py]"]
  node_calendarroute["Calendar endpoint<br/>[calendar.py]"]
end

subgraph group_domain["Training domain"]
  node_metadata["Gym and lift metadata<br/>[metadata.py]"]
  node_records["Records and PRs<br/>[records.py]"]
  node_calendar["Calendar aggregation<br/>[calendar.py]"]
  node_insights["Plateau insights<br/>[insights.py]"]
  node_today["Daily training plan<br/>[today.py]"]
  node_schemas["API data contracts<br/>[schemas.py]"]
end

subgraph group_storage["Persistence"]
  node_db["Database sessions<br/>[db.py]"]
  node_models["Workout data model<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Lifter"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_setui
node_app -->|"routes to"| node_liftui
node_app -->|"routes to"| node_todayui
node_app -->|"routes to"| node_calendarui
node_app -->|"routes to"| node_settingsui
node_setui -->|"mutates data"| node_query
node_liftui -->|"loads records"| node_query
node_todayui -->|"loads plan"| node_query
node_calendarui -->|"loads calendar"| node_query
node_settingsui -->|"loads settings"| node_query
node_query -->|"calls"| node_clientapi
node_clientapi -->|"requests API"| node_fastapi
node_fastapi -->|"registers routes"| node_routers
node_routers -->|"uses metadata logic"| node_metadata
node_routers -->|"loads lift records"| node_records
node_calendarroute -->|"builds calendar"| node_calendar
node_todayroute -->|"builds daily view"| node_today
node_today -->|"uses calendar data"| node_calendar
node_today -->|"checks plateaus"| node_insights
node_calendar -->|"uses ordering"| node_records
node_records -->|"processes sets"| node_models
node_calendar -->|"processes sets"| node_models
node_metadata -->|"queries metadata"| node_models
node_records -->|"builds responses"| node_schemas
node_calendar -->|"builds responses"| node_schemas
node_routers -->|"gets sessions"| node_db
node_calendarroute -->|"gets sessions"| node_db
node_db -->|"opens sessions"| node_postgres
node_db -.->|"stores model rows"| node_models

click node_app "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/App.tsx"
click node_setui "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/components/SetForm.tsx"
click node_liftui "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/LiftPage.tsx"
click node_todayui "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/TodayPage.tsx"
click node_calendarui "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/CalendarPage.tsx"
click node_settingsui "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_query "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/api/queries.ts"
click node_clientapi "https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/api/client.ts"
click node_fastapi "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/main.py"
click node_routers "https://github.com/coopermay/fitness-tracker/tree/main/backend/app/routers"
click node_todayroute "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/routers/today.py"
click node_calendarroute "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/routers/calendar.py"
click node_metadata "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/metadata.py"
click node_records "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/records.py"
click node_calendar "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/calendar.py"
click node_insights "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/insights.py"
click node_today "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/today.py"
click node_schemas "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/schemas.py"
click node_db "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/db.py"
click node_models "https://github.com/coopermay/fitness-tracker/blob/main/backend/app/models.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_setui,node_liftui,node_todayui,node_calendarui,node_settingsui,node_query,node_clientapi toneBlue
class node_fastapi,node_routers,node_todayroute,node_calendarroute toneAmber
class node_metadata,node_records,node_calendar,node_insights,node_today,node_schemas toneMint
class node_db,node_models,node_postgres toneRose
class node_user toneIndigo
```

## Components

### Workout interface

- [Routes and screens](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Set logging](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/components/SetForm.tsx): `frontend/src/components/SetForm.tsx`
- [Lift records](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/LiftPage.tsx): `frontend/src/pages/LiftPage.tsx`
- [Today plan](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/TodayPage.tsx): `frontend/src/pages/TodayPage.tsx`
- [Workout calendar](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/CalendarPage.tsx): `frontend/src/pages/CalendarPage.tsx`
- [Settings and split](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [Query hooks](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/api/queries.ts): `frontend/src/api/queries.ts`
- [HTTP client](https://github.com/coopermay/fitness-tracker/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### Application API

- [API registration](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/main.py): `backend/app/main.py`
- [Resource endpoints](https://github.com/coopermay/fitness-tracker/tree/main/backend/app/routers): `backend/app/routers`
- [Today endpoint](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/routers/today.py): `backend/app/routers/today.py`
- [Calendar endpoint](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/routers/calendar.py): `backend/app/routers/calendar.py`

### Training domain

- [Gym and lift metadata](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/metadata.py): `backend/app/metadata.py`
- [Records and PRs](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/records.py): `backend/app/records.py`
- [Calendar aggregation](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/calendar.py): `backend/app/calendar.py`
- [Plateau insights](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/insights.py): `backend/app/insights.py`
- [Daily training plan](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/today.py): `backend/app/today.py`
- [API data contracts](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Persistence

- [Database sessions](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/db.py): `backend/app/db.py`
- [Workout data model](https://github.com/coopermay/fitness-tracker/blob/main/backend/app/models.py): `backend/app/models.py`
- **PostgreSQL**

### Other components

- **Lifter**

## Connections

- Lifter → Routes and screens: uses (evidence: `frontend/src/App.tsx`)
- Routes and screens → Set logging: routes to (evidence: `frontend/src/App.tsx`)
- Routes and screens → Lift records: routes to (evidence: `frontend/src/App.tsx`)
- Routes and screens → Today plan: routes to (evidence: `frontend/src/App.tsx`)
- Routes and screens → Workout calendar: routes to (evidence: `frontend/src/App.tsx`)
- Routes and screens → Settings and split: routes to (evidence: `frontend/src/App.tsx`)
- Set logging → Query hooks: mutates data (evidence: `frontend/src/components/SetForm.tsx`)
- Lift records → Query hooks: loads records (evidence: `frontend/src/pages/LiftPage.tsx`)
- Today plan → Query hooks: loads plan (evidence: `frontend/src/pages/TodayPage.tsx`)
- Workout calendar → Query hooks: loads calendar (evidence: `frontend/src/pages/CalendarPage.tsx`)
- Settings and split → Query hooks: loads settings (evidence: `frontend/src/pages/SettingsPage.tsx`)
- Query hooks → HTTP client: calls (evidence: `frontend/src/api/queries.ts`)
- HTTP client → API registration: requests API (evidence: `README.md`)
- API registration → Resource endpoints: registers routes (evidence: `backend/app/main.py`)
- Resource endpoints → Gym and lift metadata: uses metadata logic (evidence: `backend/app/routers/lifts.py`)
- Resource endpoints → Records and PRs: loads lift records (evidence: `backend/app/routers/lifts.py`)
- Calendar endpoint → Calendar aggregation: builds calendar (evidence: `backend/app/routers/calendar.py`)
- Today endpoint → Daily training plan: builds daily view (evidence: `backend/app/routers/today.py`)
- Daily training plan → Calendar aggregation: uses calendar data (evidence: `backend/app/today.py`)
- Daily training plan → Plateau insights: checks plateaus (evidence: `backend/app/today.py`)
- Calendar aggregation → Records and PRs: uses ordering (evidence: `backend/app/calendar.py`)
- Records and PRs → Workout data model: processes sets (evidence: `backend/app/records.py`)
- Calendar aggregation → Workout data model: processes sets (evidence: `backend/app/calendar.py`)
- Gym and lift metadata → Workout data model: queries metadata (evidence: `backend/app/metadata.py`)
- Records and PRs → API data contracts: builds responses (evidence: `backend/app/records.py`)
- Calendar aggregation → API data contracts: builds responses (evidence: `backend/app/calendar.py`)
- Resource endpoints → Database sessions: gets sessions (evidence: `backend/app/routers/lifts.py`)
- Calendar endpoint → Database sessions: gets sessions (evidence: `backend/app/routers/calendar.py`)
- Database sessions → PostgreSQL: opens sessions (evidence: `backend/app/db.py`)
- Database sessions → Workout data model: stores model rows
