# vincent-agi/opengym architecture

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

- Interactive diagram: https://gitdiagram.com/vincent-agi/opengym
- Repository: https://github.com/vincent-agi/opengym

## Overview

openGym is a self-hosted workout planner and tracker, with a standalone browser demo and native Android option. The main workflow is profile sign-in, plan selection, guided workout logging, then reviewing history and progress; profile state syncs through the API in a self-hosted instance. The graph also preserves the documented library, import/export, sharing, notifications, and admin capabilities. The README establishes several product relationships; source excerpts clarify app routing, state persistence, and workout entry. Unsampled server and view implementations limit finer-grained call links.

Main entry points: [`frontend/src/App.jsx`](https://github.com/vincent-agi/opengym/blob/main/frontend/src/App.jsx) (App shell), [`frontend/src/views/Workout.jsx`](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Workout.jsx) (Guided workout), [`frontend/src/views/Settings.jsx`](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Settings.jsx) (Settings and backup), [`frontend/src/store/useStore.js`](https://github.com/vincent-agi/opengym/blob/main/frontend/src/store/useStore.js) (Profile state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["App experience"]
  node_app["App shell<br/>[App.jsx]"]
  node_login["Passkey login<br/>[Login.jsx]"]
  node_home["Home dashboard<br/>[Home.jsx]"]
  node_translations["Localization<br/>[i18n.js]"]
end

subgraph group_training["Training workflow"]
  node_plan["Weekly plan<br/>[Plan.jsx]"]
  node_routine["Routine editor<br/>[RoutineEdit.jsx]"]
  node_workout["Guided workout<br/>[Workout.jsx]"]
  node_flow["Workout flow sheets<br/>[sheets.jsx]"]
  node_library["Exercise library<br/>[Library.jsx]"]
  node_exercise_catalog[("Exercise catalogue<br/>[exercises-data.js]")]
end

subgraph group_insights["Progress and data"]
  node_stats["Stats and charts<br/>[Stats.jsx]"]
  node_history["Workout history<br/>[History.jsx]"]
  node_history_logic["History analytics<br/>[history.js]"]
  node_settings["Settings and backup<br/>[Settings.jsx]"]
  node_plan_share["Plan sharing<br/>[plan-share.js]"]
  node_csv_import["History import<br/>[import-csv.js]"]
end

subgraph group_platform["Self-hosted platform"]
  node_state["Profile state<br/>[useStore.js]"]
  node_ui_state["UI and timers<br/>[useUI.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_server["Application API<br/>[server.js]"]
  node_data_store[("Self-hosted data")]
  node_admin["Admin dashboard<br/>[Admin.jsx]"]
  node_push["Push notifications<br/>[push.js]"]
  node_mobile["Native mobile bridge<br/>[mobile.js]"]
end

node_user(("Gym user"))

node_user -->|"opens"| node_app
node_app -->|"routes"| node_login
node_app -->|"routes"| node_home
node_app -->|"routes"| node_plan
node_app -->|"routes"| node_routine
node_app -->|"routes"| node_workout
node_app -->|"routes"| node_stats
node_app -->|"routes"| node_history
node_app -->|"routes"| node_library
node_app -->|"routes"| node_settings
node_app -->|"routes"| node_admin
node_user -->|"builds routines"| node_plan
node_plan -->|"edits routines"| node_routine
node_user -->|"starts session"| node_workout
node_workout -->|"starts flow"| node_flow
node_library -->|"searches"| node_exercise_catalog
node_routine -->|"selects exercises"| node_exercise_catalog
node_workout -->|"logs sets"| node_state
node_workout -->|"uses set history"| node_history_logic
node_user -->|"reviews progress"| node_stats
node_stats -->|"summarizes"| node_history_logic
node_history -.->|"presents history"| node_history_logic
node_settings -.->|"imports workouts"| node_csv_import
node_settings -.->|"shares plans"| node_plan_share
node_user -->|"manages data"| node_settings
node_login -.->|"authenticates"| node_api_client
node_state -->|"syncs state"| node_api_client
node_api_client -.->|"requests data"| node_server
node_server -->|"persists profiles"| node_data_store
node_state -->|"mirrors state"| node_mobile
node_settings -.->|"configures reminders"| node_push
node_admin -.->|"administers instance"| node_server
node_app -->|"sets language"| node_translations
node_workout -.->|"uses workout timers"| node_ui_state

click node_app "https://github.com/vincent-agi/opengym/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Login.jsx"
click node_home "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Home.jsx"
click node_plan "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Plan.jsx"
click node_routine "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/RoutineEdit.jsx"
click node_workout "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Workout.jsx"
click node_flow "https://github.com/vincent-agi/opengym/blob/main/frontend/src/sheets.jsx"
click node_library "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Library.jsx"
click node_exercise_catalog "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/exercises-data.js"
click node_stats "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Stats.jsx"
click node_history "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/History.jsx"
click node_history_logic "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/history.js"
click node_settings "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Settings.jsx"
click node_plan_share "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/plan-share.js"
click node_csv_import "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/import-csv.js"
click node_state "https://github.com/vincent-agi/opengym/blob/main/frontend/src/store/useStore.js"
click node_ui_state "https://github.com/vincent-agi/opengym/blob/main/frontend/src/store/useUI.js"
click node_api_client "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/api.js"
click node_server "https://github.com/vincent-agi/opengym/blob/main/api/server.js"
click node_admin "https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Admin.jsx"
click node_push "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/push.js"
click node_mobile "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/mobile.js"
click node_translations "https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/i18n.js"

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_login,node_home,node_translations,node_user toneBlue
class node_plan,node_routine,node_workout,node_flow,node_library,node_exercise_catalog toneAmber
class node_stats,node_history,node_history_logic,node_settings,node_plan_share,node_csv_import toneMint
class node_state,node_ui_state,node_api_client,node_server,node_data_store,node_admin,node_push,node_mobile toneRose
```

## Components

### App experience

- [App shell](https://github.com/vincent-agi/opengym/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Passkey login](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Login.jsx): `frontend/src/views/Login.jsx`
- [Home dashboard](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Home.jsx): `frontend/src/views/Home.jsx`
- [Localization](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/i18n.js): `frontend/src/lib/i18n.js`

### Training workflow

- [Weekly plan](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Plan.jsx): `frontend/src/views/Plan.jsx`
- [Routine editor](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/RoutineEdit.jsx): `frontend/src/views/RoutineEdit.jsx`
- [Guided workout](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Workout.jsx): `frontend/src/views/Workout.jsx`
- [Workout flow sheets](https://github.com/vincent-agi/opengym/blob/main/frontend/src/sheets.jsx): `frontend/src/sheets.jsx`
- [Exercise library](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Library.jsx): `frontend/src/views/Library.jsx`
- [Exercise catalogue](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/exercises-data.js): `frontend/src/lib/exercises-data.js`

### Progress and data

- [Stats and charts](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Stats.jsx): `frontend/src/views/Stats.jsx`
- [Workout history](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/History.jsx): `frontend/src/views/History.jsx`
- [History analytics](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/history.js): `frontend/src/lib/history.js`
- [Settings and backup](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Settings.jsx): `frontend/src/views/Settings.jsx`
- [Plan sharing](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/plan-share.js): `frontend/src/lib/plan-share.js`
- [History import](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/import-csv.js): `frontend/src/lib/import-csv.js`

### Self-hosted platform

- [Profile state](https://github.com/vincent-agi/opengym/blob/main/frontend/src/store/useStore.js): `frontend/src/store/useStore.js`
- [UI and timers](https://github.com/vincent-agi/opengym/blob/main/frontend/src/store/useUI.js): `frontend/src/store/useUI.js`
- [API client](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Application API](https://github.com/vincent-agi/opengym/blob/main/api/server.js): `api/server.js`
- **Self-hosted data**
- [Admin dashboard](https://github.com/vincent-agi/opengym/blob/main/frontend/src/views/Admin.jsx): `frontend/src/views/Admin.jsx`
- [Push notifications](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/push.js): `frontend/src/lib/push.js`
- [Native mobile bridge](https://github.com/vincent-agi/opengym/blob/main/frontend/src/lib/mobile.js): `frontend/src/lib/mobile.js`

### Other components

- **Gym user**

## Connections

- Gym user → App shell: opens
- App shell → Passkey login: routes (evidence: `frontend/src/App.jsx`)
- App shell → Home dashboard: routes (evidence: `frontend/src/App.jsx`)
- App shell → Weekly plan: routes (evidence: `frontend/src/App.jsx`)
- App shell → Routine editor: routes (evidence: `frontend/src/App.jsx`)
- App shell → Guided workout: routes (evidence: `frontend/src/App.jsx`)
- App shell → Stats and charts: routes (evidence: `frontend/src/App.jsx`)
- App shell → Workout history: routes (evidence: `frontend/src/App.jsx`)
- App shell → Exercise library: routes (evidence: `frontend/src/App.jsx`)
- App shell → Settings and backup: routes (evidence: `frontend/src/App.jsx`)
- App shell → Admin dashboard: routes (evidence: `frontend/src/App.jsx`)
- Gym user → Weekly plan: builds routines
- Weekly plan → Routine editor: edits routines
- Gym user → Guided workout: starts session
- Guided workout → Workout flow sheets: starts flow (evidence: `frontend/src/views/Workout.jsx`)
- Exercise library → Exercise catalogue: searches
- Routine editor → Exercise catalogue: selects exercises
- Guided workout → Profile state: logs sets (evidence: `frontend/src/views/Workout.jsx`)
- Guided workout → History analytics: uses set history (evidence: `frontend/src/views/Workout.jsx`)
- Gym user → Stats and charts: reviews progress
- Stats and charts → History analytics: summarizes (evidence: `frontend/src/views/Stats.jsx`)
- Workout history → History analytics: presents history
- Settings and backup → History import: imports workouts
- Settings and backup → Plan sharing: shares plans
- Gym user → Settings and backup: manages data
- Passkey login → API client: authenticates
- Profile state → API client: syncs state (evidence: `frontend/src/store/useStore.js`)
- API client → Application API: requests data
- Application API → Self-hosted data: persists profiles
- Profile state → Native mobile bridge: mirrors state (evidence: `frontend/src/store/useStore.js`)
- Settings and backup → Push notifications: configures reminders (evidence: `frontend/src/views/Settings.jsx`)
- Admin dashboard → Application API: administers instance
- App shell → Localization: sets language (evidence: `frontend/src/App.jsx`)
- Guided workout → UI and timers: uses workout timers (evidence: `frontend/src/views/Workout.jsx`)
