# mandeep15686/ai-fitness-coach architecture

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

- Interactive diagram: https://gitdiagram.com/mandeep15686/ai-fitness-coach
- Repository: https://github.com/mandeep15686/ai-fitness-coach

## Overview

AI Fitness Coach combines a documented Flutter client with Python posture-analysis tools. The documented user workflow is to select an exercise, capture a pose, and receive rep/form feedback; the Python API accepts pose landmarks and returns exercise or form analysis. The supplied tree does not contain the Flutter `lib/` sources, so that client is represented only at its existing enclosing path, with documented links distinguished from inspected implementation. The desktop Python entry point and API are separate runtime entry points; training is included as a backend capability, but its artifact handoff is not shown.

Main entry points: [`python_model/src/api_server.py`](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/api_server.py) (FastAPI endpoints), [`python_model/src/main.py`](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/main.py) (Desktop entry), [`ai_fitness_coach`](https://github.com/mandeep15686/ai-fitness-coach/tree/main/ai_fitness_coach) (Flutter app), [`python_model/models/Pose_detection.py`](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/models/Pose_detection.py) (Live pose feedback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Fitness Client"]
  node_flutter["Flutter app"]
  node_phone_camera["Phone camera"]
  node_mlkit["On-device pose detection"]
end

subgraph group_analysis["Posture Analysis"]
  node_desktop_entry["Desktop entry<br/>[main.py]"]
  node_pose_feedback["Live pose feedback<br/>[Pose_detection.py]"]
  node_classifier["Form classifier"]
end

subgraph group_backend["Python Backend"]
  node_api["FastAPI endpoints<br/>[api_server.py]"]
  node_rules["Posture rules<br/>[posture_rules.py]"]
  node_angles["Joint angle utilities<br/>[angle_utils.py]"]
  node_training["Model training<br/>[train_model.py]"]
end

node_user(("Fitness user"))
node_rest_client["REST client"]

node_user -->|"uses"| node_flutter
node_phone_camera -->|"captures poses"| node_mlkit
node_mlkit -->|"provides landmarks"| node_flutter
node_flutter -.->|"sends landmarks"| node_api
node_rest_client -->|"requests analysis"| node_api
node_api -->|"returns analysis"| node_rest_client
node_desktop_entry -->|"starts feedback"| node_pose_feedback
node_desktop_entry -->|"loads model"| node_classifier
node_desktop_entry -->|"passes model"| node_pose_feedback
node_pose_feedback -->|"predicts form"| node_classifier
node_api -->|"gets feedback"| node_rules
node_rules -->|"uses angles"| node_angles

click node_flutter "https://github.com/mandeep15686/ai-fitness-coach/tree/main/ai_fitness_coach"
click node_desktop_entry "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/main.py"
click node_pose_feedback "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/models/Pose_detection.py"
click node_classifier "https://github.com/mandeep15686/ai-fitness-coach/tree/main/python_model/models"
click node_api "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/api_server.py"
click node_rules "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/posture_rules.py"
click node_angles "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/angle_utils.py"
click node_training "https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/train_model.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_flutter,node_phone_camera,node_mlkit,node_user,node_rest_client toneBlue
class node_desktop_entry,node_pose_feedback,node_classifier toneAmber
class node_api,node_rules,node_angles,node_training toneMint
```

## Components

### Fitness Client

- [Flutter app](https://github.com/mandeep15686/ai-fitness-coach/tree/main/ai_fitness_coach): `ai_fitness_coach`
- **Phone camera**
- **On-device pose detection**

### Posture Analysis

- [Desktop entry](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/main.py): `python_model/src/main.py`
- [Live pose feedback](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/models/Pose_detection.py): `python_model/models/Pose_detection.py`
- [Form classifier](https://github.com/mandeep15686/ai-fitness-coach/tree/main/python_model/models): `python_model/models`

### Python Backend

- [FastAPI endpoints](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/api_server.py): `python_model/src/api_server.py`
- [Posture rules](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/posture_rules.py): `python_model/src/posture_rules.py`
- [Joint angle utilities](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/angle_utils.py): `python_model/src/angle_utils.py`
- [Model training](https://github.com/mandeep15686/ai-fitness-coach/blob/main/python_model/src/train_model.py): `python_model/src/train_model.py`

### Other components

- **Fitness user**
- **REST client**

## Connections

- Fitness user → Flutter app: uses
- Phone camera → On-device pose detection: captures poses
- On-device pose detection → Flutter app: provides landmarks
- Flutter app → FastAPI endpoints: sends landmarks
- REST client → FastAPI endpoints: requests analysis (evidence: `python_model/src/api_server.py`)
- FastAPI endpoints → REST client: returns analysis (evidence: `python_model/src/api_server.py`)
- Desktop entry → Live pose feedback: starts feedback (evidence: `python_model/src/main.py`)
- Desktop entry → Form classifier: loads model (evidence: `python_model/src/main.py`)
- Desktop entry → Live pose feedback: passes model (evidence: `python_model/src/main.py`)
- Live pose feedback → Form classifier: predicts form (evidence: `python_model/models/Pose_detection.py`)
- FastAPI endpoints → Posture rules: gets feedback (evidence: `python_model/src/api_server.py`)
- Posture rules → Joint angle utilities: uses angles (evidence: `python_model/src/posture_rules.py`)
