# youssef266/fitai architecture

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

- Interactive diagram: https://gitdiagram.com/youssef266/fitai
- Repository: https://github.com/youssef266/fitai

## Overview

FitAI is a Flask fitness-planning application. Users register or log in, enter fitness details, request an AI-generated plan, and can save and revisit plans; account editing and plan pagination are also present. The graph distinguishes these user-facing stages from SQLAlchemy persistence and the LLM integration. README-described progress tracking and adaptive workouts are noted as product capabilities, but the sampled source does not show their implementation, so no unsupported runtime connections are inferred.

Main entry points: [`main.py`](https://github.com/youssef266/fitai/blob/main/main.py) (Flask routes), [`models/user.py`](https://github.com/youssef266/fitai/blob/main/models/user.py) (User records), [`models/programs.py`](https://github.com/youssef266/fitai/blob/main/models/programs.py) (Saved programs), [`models/base_model.py`](https://github.com/youssef266/fitai/blob/main/models/base_model.py) (Shared model fields)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journey["User journeys"]
  node_web["Flask routes<br/>[main.py]"]
  node_public_pages["Public pages<br/>[home.html]"]
end

subgraph group_plans["Fitness programs"]
  node_plan_form["Plan request form<br/>[service.html]"]
  node_generation["Plan generation<br/>[main.py]"]
  node_generated_page["Generated plan page<br/>[AI_Genrated.html]"]
  node_save_plan["Save plan<br/>[main.py]"]
  node_program_list["Plan history<br/>[main.py]"]
  node_programs_page["Programs page<br/>[programs.html]"]
end

subgraph group_identity["Accounts"]
  node_registration["Registration<br/>[main.py]"]
  node_login["Login and logout<br/>[main.py]"]
  node_account["Account editing<br/>[main.py]"]
end

subgraph group_data["Persistence"]
  node_user_model["User records<br/>[user.py]"]
  node_base_model["Shared model fields<br/>[base_model.py]"]
  node_sqlite[("SQLite database")]
  node_program_model["Saved programs<br/>[programs.py]"]
end

node_visitor(("User"))
node_llm{{"Groq LLaMA service"}}

node_visitor -->|"uses"| node_web
node_web -->|"renders"| node_public_pages
node_web -->|"routes to"| node_registration
node_web -->|"routes to"| node_login
node_web -->|"routes to"| node_account
node_registration -->|"creates"| node_user_model
node_login -->|"queries"| node_user_model
node_account -->|"reads and updates"| node_user_model
node_user_model -->|"inherits fields"| node_base_model
node_program_model -->|"inherits fields"| node_base_model
node_web -->|"queries"| node_user_model
node_web -->|"renders"| node_plan_form
node_visitor -->|"submits details"| node_generation
node_generation -->|"requests plan"| node_llm
node_generation -->|"queries user"| node_user_model
node_generation -->|"renders result"| node_generated_page
node_visitor -->|"saves plan"| node_save_plan
node_save_plan -->|"creates record"| node_program_model
node_web -->|"routes to"| node_program_list
node_program_list -->|"queries plans"| node_program_model
node_program_list -->|"renders"| node_programs_page
node_user_model -->|"persists records"| node_sqlite
node_program_model -->|"persists records"| node_sqlite

click node_web "https://github.com/youssef266/fitai/blob/main/main.py"
click node_public_pages "https://github.com/youssef266/fitai/blob/main/templates/content/home.html"
click node_registration "https://github.com/youssef266/fitai/blob/main/main.py"
click node_login "https://github.com/youssef266/fitai/blob/main/main.py"
click node_account "https://github.com/youssef266/fitai/blob/main/main.py"
click node_user_model "https://github.com/youssef266/fitai/blob/main/models/user.py"
click node_base_model "https://github.com/youssef266/fitai/blob/main/models/base_model.py"
click node_plan_form "https://github.com/youssef266/fitai/blob/main/templates/content/service.html"
click node_generation "https://github.com/youssef266/fitai/blob/main/main.py"
click node_generated_page "https://github.com/youssef266/fitai/blob/main/templates/content/AI_Genrated.html"
click node_save_plan "https://github.com/youssef266/fitai/blob/main/main.py"
click node_program_model "https://github.com/youssef266/fitai/blob/main/models/programs.py"
click node_program_list "https://github.com/youssef266/fitai/blob/main/main.py"
click node_programs_page "https://github.com/youssef266/fitai/blob/main/templates/content/programs.html"

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_web,node_public_pages,node_visitor toneBlue
class node_plan_form,node_generation,node_generated_page,node_save_plan,node_program_list,node_programs_page toneAmber
class node_registration,node_login,node_account toneMint
class node_user_model,node_base_model,node_sqlite,node_program_model toneRose
class node_llm toneIndigo
```

## Components

### User journeys

- [Flask routes](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Public pages](https://github.com/youssef266/fitai/blob/main/templates/content/home.html): `templates/content/home.html`

### Fitness programs

- [Plan request form](https://github.com/youssef266/fitai/blob/main/templates/content/service.html): `templates/content/service.html`
- [Plan generation](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Generated plan page](https://github.com/youssef266/fitai/blob/main/templates/content/AI_Genrated.html): `templates/content/AI_Genrated.html`
- [Save plan](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Plan history](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Programs page](https://github.com/youssef266/fitai/blob/main/templates/content/programs.html): `templates/content/programs.html`

### Accounts

- [Registration](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Login and logout](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`
- [Account editing](https://github.com/youssef266/fitai/blob/main/main.py): `main.py`

### Persistence

- [User records](https://github.com/youssef266/fitai/blob/main/models/user.py): `models/user.py`
- [Shared model fields](https://github.com/youssef266/fitai/blob/main/models/base_model.py): `models/base_model.py`
- **SQLite database**
- [Saved programs](https://github.com/youssef266/fitai/blob/main/models/programs.py): `models/programs.py`

### Other components

- **User**
- **Groq LLaMA service**

## Connections

- User → Flask routes: uses (evidence: `README.md`)
- Flask routes → Public pages: renders (evidence: `main.py`)
- Flask routes → Registration: routes to (evidence: `main.py`)
- Flask routes → Login and logout: routes to (evidence: `main.py`)
- Flask routes → Account editing: routes to (evidence: `main.py`)
- Registration → User records: creates (evidence: `main.py`)
- Login and logout → User records: queries (evidence: `main.py`)
- Account editing → User records: reads and updates (evidence: `main.py`)
- User records → Shared model fields: inherits fields (evidence: `models/user.py`)
- Saved programs → Shared model fields: inherits fields (evidence: `models/programs.py`)
- Flask routes → User records: queries (evidence: `main.py`)
- Flask routes → Plan request form: renders (evidence: `main.py`)
- User → Plan generation: submits details (evidence: `README.md`)
- Plan generation → Groq LLaMA service: requests plan (evidence: `main.py`)
- Plan generation → User records: queries user (evidence: `main.py`)
- Plan generation → Generated plan page: renders result (evidence: `main.py`)
- User → Save plan: saves plan (evidence: `main.py`)
- Save plan → Saved programs: creates record (evidence: `main.py`)
- Flask routes → Plan history: routes to (evidence: `main.py`)
- Plan history → Saved programs: queries plans (evidence: `main.py`)
- Plan history → Programs page: renders (evidence: `main.py`)
- User records → SQLite database: persists records (evidence: `models/user.py`)
- Saved programs → SQLite database: persists records (evidence: `models/programs.py`)
