# xia0o0/smartfisio architecture

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

- Interactive diagram: https://gitdiagram.com/xia0o0/smartfisio
- Repository: https://github.com/xia0o0/smartfisio

## Overview

SmartFisio is an accessible exercise and progress-tracking application for older adults, with a therapist-facing patient view. The principal flow is authentication, exercise discovery and guided performance, then saving activity and posture data for progress review; therapists can view patient information. React pages call a FastAPI API, which applies JWT authentication and persists users, exercises, activity logs, and posture alerts in PostgreSQL. The README describes on-device MediaPipe pose monitoring, but the sampled tree does not establish how the Python vision prototypes connect to the browser workflow, so that integration is shown as documented rather than inferred from prototype code.

Main entry points: [`backend/app/database.py`](https://github.com/xia0o0/smartfisio/blob/main/backend/app/database.py) (Database session and engine), [`backend/app/main.py`](https://github.com/xia0o0/smartfisio/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.jsx`](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/App.jsx) (Route and access control), [`frontend/src/services/api.js`](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/services/api.js) (HTTP API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app_router["Route and access control<br/>[App.jsx]"]
  node_auth_page["Sign in and register<br/>[AuthPage.jsx]"]
  node_layout["Role-aware navigation<br/>[AppLayout.jsx]"]
  node_dashboard["Exercise dashboard<br/>[DashboardPage.jsx]"]
  node_player["Guided exercise player"]
  node_pose_monitor["On-device pose monitoring"]
  node_progress["Progress review<br/>[ProgressPage.jsx]"]
  node_therapist_view["Patient dashboard<br/>[TherapistPage.jsx]"]
  node_api_client["HTTP API client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_access_control["JWT and role checks<br/>[auth.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
  node_db_config["Database and security config<br/>[config.py]"]
end

subgraph group_domain["Exercise and tracking"]
  node_exercise_routes["Exercise catalog routes<br/>[exercises.py]"]
  node_session_routes["Activity and alert routes<br/>[sessions.py]"]
  node_user_routes["Patient routes<br/>[users.py]"]
  node_seed["Initial catalog seeding<br/>[seed.py]"]
end

subgraph group_persistence["Persistence"]
  node_orm_models["Health domain models<br/>[models.py]"]
  node_db_session["Database session and engine<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_older_adult(("Older adult"))
node_therapist(("Physiotherapist"))

node_older_adult -->|"uses"| node_app_router
node_therapist -->|"uses"| node_app_router
node_app_router -->|"routes to"| node_auth_page
node_app_router -->|"routes to"| node_dashboard
node_app_router -->|"routes to"| node_player
node_app_router -->|"routes to"| node_progress
node_app_router -->|"routes to"| node_therapist_view
node_auth_page -->|"calls"| node_api_client
node_dashboard -->|"calls"| node_api_client
node_player -->|"calls"| node_api_client
node_progress -->|"calls"| node_api_client
node_therapist_view -->|"calls"| node_api_client
node_api_client -.->|"requests"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_exercise_routes
node_api_app -->|"registers"| node_session_routes
node_api_app -->|"registers"| node_user_routes
node_api_app -->|"runs at startup"| node_seed
node_auth_routes -->|"uses"| node_access_control
node_auth_routes -->|"uses"| node_db_session
node_exercise_routes -->|"uses"| node_access_control
node_exercise_routes -->|"uses"| node_db_session
node_session_routes -->|"uses"| node_access_control
node_session_routes -->|"uses"| node_db_session
node_user_routes -->|"uses"| node_access_control
node_user_routes -->|"uses"| node_db_session
node_auth_routes -->|"validates"| node_schemas
node_exercise_routes -->|"validates"| node_schemas
node_session_routes -->|"validates"| node_schemas
node_user_routes -->|"validates"| node_schemas
node_seed -->|"creates records"| node_orm_models
node_auth_routes -->|"queries users"| node_orm_models
node_session_routes -->|"records activity"| node_orm_models
node_db_session -->|"reads settings"| node_db_config
node_db_session -.->|"connects"| node_postgres
node_orm_models -->|"uses base"| node_db_session
node_api_app -->|"creates tables"| node_db_session
node_player -.->|"hosts"| node_pose_monitor
node_pose_monitor -->|"uses MediaPipe"| node_player

click node_app_router "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/App.jsx"
click node_auth_page "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Auth/AuthPage.jsx"
click node_layout "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/components/AppLayout/AppLayout.jsx"
click node_dashboard "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Dashboard/DashboardPage.jsx"
click node_player "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx"
click node_pose_monitor "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx"
click node_progress "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Progress/ProgressPage.jsx"
click node_therapist_view "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Therapist/TherapistPage.jsx"
click node_api_client "https://github.com/xia0o0/smartfisio/blob/main/frontend/src/services/api.js"
click node_api_app "https://github.com/xia0o0/smartfisio/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/auth.py"
click node_access_control "https://github.com/xia0o0/smartfisio/blob/main/backend/app/auth.py"
click node_exercise_routes "https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/exercises.py"
click node_session_routes "https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/sessions.py"
click node_user_routes "https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/users.py"
click node_schemas "https://github.com/xia0o0/smartfisio/blob/main/backend/app/schemas.py"
click node_seed "https://github.com/xia0o0/smartfisio/blob/main/backend/app/seed.py"
click node_orm_models "https://github.com/xia0o0/smartfisio/blob/main/backend/app/models.py"
click node_db_session "https://github.com/xia0o0/smartfisio/blob/main/backend/app/database.py"
click node_db_config "https://github.com/xia0o0/smartfisio/blob/main/backend/app/config.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_router,node_auth_page,node_layout,node_dashboard,node_player,node_pose_monitor,node_progress,node_therapist_view,node_api_client toneBlue
class node_api_app,node_auth_routes,node_access_control,node_schemas,node_db_config toneAmber
class node_exercise_routes,node_session_routes,node_user_routes,node_seed,node_therapist toneMint
class node_orm_models,node_db_session,node_postgres toneRose
class node_older_adult toneIndigo
```

## Components

### Web client

- [Route and access control](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign in and register](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Auth/AuthPage.jsx): `frontend/src/pages/Auth/AuthPage.jsx`
- [Role-aware navigation](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/components/AppLayout/AppLayout.jsx): `frontend/src/components/AppLayout/AppLayout.jsx`
- [Exercise dashboard](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Dashboard/DashboardPage.jsx): `frontend/src/pages/Dashboard/DashboardPage.jsx`
- [Guided exercise player](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx): `frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx`
- [On-device pose monitoring](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx): `frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx`
- [Progress review](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Progress/ProgressPage.jsx): `frontend/src/pages/Progress/ProgressPage.jsx`
- [Patient dashboard](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/pages/Therapist/TherapistPage.jsx): `frontend/src/pages/Therapist/TherapistPage.jsx`
- [HTTP API client](https://github.com/xia0o0/smartfisio/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and identity

- [FastAPI application](https://github.com/xia0o0/smartfisio/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [JWT and role checks](https://github.com/xia0o0/smartfisio/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Request and response schemas](https://github.com/xia0o0/smartfisio/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Database and security config](https://github.com/xia0o0/smartfisio/blob/main/backend/app/config.py): `backend/app/config.py`

### Exercise and tracking

- [Exercise catalog routes](https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/exercises.py): `backend/app/routers/exercises.py`
- [Activity and alert routes](https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/sessions.py): `backend/app/routers/sessions.py`
- [Patient routes](https://github.com/xia0o0/smartfisio/blob/main/backend/app/routers/users.py): `backend/app/routers/users.py`
- [Initial catalog seeding](https://github.com/xia0o0/smartfisio/blob/main/backend/app/seed.py): `backend/app/seed.py`

### Persistence

- [Health domain models](https://github.com/xia0o0/smartfisio/blob/main/backend/app/models.py): `backend/app/models.py`
- [Database session and engine](https://github.com/xia0o0/smartfisio/blob/main/backend/app/database.py): `backend/app/database.py`
- **PostgreSQL**

### Other components

- **Older adult**
- **Physiotherapist**

## Connections

- Older adult → Route and access control: uses (evidence: `README.md`)
- Physiotherapist → Route and access control: uses (evidence: `README.md`)
- Route and access control → Sign in and register: routes to (evidence: `frontend/src/App.jsx`)
- Route and access control → Exercise dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Route and access control → Guided exercise player: routes to (evidence: `frontend/src/App.jsx`)
- Route and access control → Progress review: routes to (evidence: `frontend/src/App.jsx`)
- Route and access control → Patient dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Sign in and register → HTTP API client: calls (evidence: `frontend/src/pages/Auth/AuthPage.jsx`)
- Exercise dashboard → HTTP API client: calls (evidence: `frontend/src/pages/Dashboard/DashboardPage.jsx`)
- Guided exercise player → HTTP API client: calls (evidence: `frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx`)
- Progress review → HTTP API client: calls (evidence: `frontend/src/pages/Progress/ProgressPage.jsx`)
- Patient dashboard → HTTP API client: calls (evidence: `frontend/src/pages/Therapist/TherapistPage.jsx`)
- HTTP API client → FastAPI application: requests
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Exercise catalog routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Activity and alert routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Patient routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Initial catalog seeding: runs at startup (evidence: `backend/app/main.py`)
- Authentication routes → JWT and role checks: uses (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Database session and engine: uses (evidence: `backend/app/routers/auth.py`)
- Exercise catalog routes → JWT and role checks: uses (evidence: `backend/app/routers/exercises.py`)
- Exercise catalog routes → Database session and engine: uses (evidence: `backend/app/routers/exercises.py`)
- Activity and alert routes → JWT and role checks: uses (evidence: `backend/app/routers/sessions.py`)
- Activity and alert routes → Database session and engine: uses (evidence: `backend/app/routers/sessions.py`)
- Patient routes → JWT and role checks: uses (evidence: `backend/app/routers/users.py`)
- Patient routes → Database session and engine: uses (evidence: `backend/app/routers/users.py`)
- Authentication routes → Request and response schemas: validates (evidence: `backend/app/routers/auth.py`)
- Exercise catalog routes → Request and response schemas: validates (evidence: `backend/app/routers/exercises.py`)
- Activity and alert routes → Request and response schemas: validates (evidence: `backend/app/routers/sessions.py`)
- Patient routes → Request and response schemas: validates (evidence: `backend/app/routers/users.py`)
- Initial catalog seeding → Health domain models: creates records (evidence: `backend/app/seed.py`)
- Authentication routes → Health domain models: queries users (evidence: `backend/app/routers/auth.py`)
- Activity and alert routes → Health domain models: records activity (evidence: `backend/app/routers/sessions.py`)
- Database session and engine → Database and security config: reads settings (evidence: `backend/app/database.py`)
- Database session and engine → PostgreSQL: connects
- Health domain models → Database session and engine: uses base (evidence: `backend/app/models.py`)
- FastAPI application → Database session and engine: creates tables (evidence: `backend/app/main.py`)
- Guided exercise player → On-device pose monitoring: hosts (evidence: `frontend/src/pages/ExercisePlayer/ExercisePlayerPage.jsx`)
- On-device pose monitoring → Guided exercise player: uses MediaPipe (evidence: `README.md`)
