How amitdas4321/opengym works
openGym is a self-hosted workout and body-weight tracker: users sign in, plan routines, log guided workouts, and review progress, with state synchronized through a REST API to a selectable database. The frontend also supports imports/exports, passkeys, reminders, localization, and installable offline use. The graph follows the documented app-to-server-to-storage structure and includes the major training and analytics capabilities. Some view implementations were not sampled, so their internal calls are not inferred.
Main entry points: App.jsx App shell · Stats.jsx Stats and charts · Settings.jsx Settings and export · useStore.js Workout state
Components 28
App and State
- App shell
src/App.jsx - Workout state
src/store/useStore.js - UI state
src/store/useUI.js - Action sheets
src/sheets.jsx
Training and Planning
- Home and weight
src/views/Home.jsx - Weekly planner
src/views/Plan.jsx - Routine editor
src/views/RoutineEdit.jsx - Guided workout
src/views/Workout.jsx - Exercise catalogue
src/lib/exercises.js
Progress and Insights
- Workout history
src/lib/history.js - History view
src/views/History.jsx - Stats and charts
src/views/Stats.jsx - Muscle map
src/components/BodyMap.jsx - Trend charts
src/components/LineChart.jsx - History import
src/lib/import-csv.js
Account and Platform
- Settings and export
src/views/Settings.jsx - Passkey login
src/views/Login.jsx - Localization
src/lib/i18n.js - Mobile and PWA
src/lib/mobile.js - Push reminders
src/lib/push.js
Server and Storage
- REST client
src/lib/api.js - Unified server
server.js - Database service
database/index.js - Firebase provider
database/providers/firebase.js - MySQL provider
database/providers/mysql.js - MongoDB provider
database/providers/mongodb.js
Other components
- Gym user
- Configured database
Connections 39
- Gym user → App shell: uses
- App shell → Home and weight: routes to
src/App.jsx - App shell → Weekly planner: routes to
src/App.jsx - App shell → Routine editor: routes to
src/App.jsx - App shell → Guided workout: routes to
src/App.jsx - App shell → Stats and charts: routes to
src/App.jsx - App shell → History view: routes to
src/App.jsx - App shell → Settings and export: routes to
src/App.jsx - App shell → Passkey login: routes to
src/App.jsx - App shell → Workout state: reads
src/App.jsx - Workout state → REST client: syncs state
src/store/useStore.js - REST client → Unified server: HTTP requests
- Unified server → Database service: uses
server.js - Database service → Firebase provider: dispatches
database/index.js - Database service → MySQL provider: dispatches
database/index.js - Database service → MongoDB provider: dispatches
database/index.js - Firebase provider → Configured database: reads and writes
- MySQL provider → Configured database: reads and writes
- MongoDB provider → Configured database: reads and writes
- Weekly planner → Routine editor: assigns routines
- Routine editor → Exercise catalogue: selects exercises
- Guided workout → Workout history: records sets
src/views/Workout.jsx - Guided workout → Workout state: updates workout data
src/views/Workout.jsx - History view → Workout history: summarizes
- Stats and charts → Workout history: analyzes
src/views/Stats.jsx - Stats and charts → Trend charts: renders trends
src/views/Stats.jsx - Stats and charts → Muscle map: renders muscle map
src/views/Stats.jsx - Settings and export → History import: imports history
- Settings and export → REST client: uses account API
src/views/Settings.jsx - Workout state → Mobile and PWA: loads and saves
src/store/useStore.js - Settings and export → Push reminders: configures reminders
src/views/Settings.jsx - UI state → REST client: schedules timer alert
src/store/useUI.js - UI state → Workout state: reads preferences
src/store/useUI.js - App shell → Action sheets: mounts
src/App.jsx - Routine editor → Action sheets: opens editors
- Gym user → Settings and export: configures account
- Gym user → Weekly planner: plans week
- Gym user → Guided workout: trains and logs
- Gym user → Stats and charts: reviews progress