# serpentmaks/workout-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/serpentmaks/workout-tracker
- Repository: https://github.com/serpentmaks/workout-tracker

## Overview

BentoFit is an offline-capable iPhone workout-tracking PWA. Its main flow lets a user start a scheduled, template-based, or free workout, log sets, and retain the completed session for later history and analytics. Other documented or visible capabilities include an exercise catalog, cycle scheduling, rest timer with feedback, body metrics, settings, data import/export, and offline caching. The controller excerpt directly supports its storage and timer use; several feature-to-controller links are omitted because sampled excerpts do not show those calls.

Main entry points: [`js/app.js`](https://github.com/serpentmaks/workout-tracker/blob/main/js/app.js) (Workout app controller), [`js/storage.js`](https://github.com/serpentmaks/workout-tracker/blob/main/js/storage.js) (Local state manager), [`js/timer.js`](https://github.com/serpentmaks/workout-tracker/blob/main/js/timer.js) (Rest timer), [`js/audio.js`](https://github.com/serpentmaks/workout-tracker/blob/main/js/audio.js) (Audio & haptics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workout["Workout Tracking"]
  node_app["Workout app controller<br/>[app.js]"]
  node_timer["Rest timer<br/>[timer.js]"]
  node_feedback["Audio &amp; haptics<br/>[audio.js]"]
end

subgraph group_planning["Plans &amp; Exercise Data"]
  node_catalog["Exercise catalog data<br/>[exercises-data.js]"]
  node_schedule["Cycle scheduler<br/>[schedule.js]"]
end

subgraph group_insights["History &amp; Profile"]
  node_analytics["History &amp; analytics<br/>[analytics.js]"]
end

subgraph group_runtime["App Runtime"]
  node_storage["Local state manager<br/>[storage.js]"]
  node_localstore[("Browser local storage")]
  node_serviceworker["Offline service worker<br/>[sw.js]"]
end

node_user(("iPhone user"))
node_browser(("iPhone browser"))

node_user -->|"uses"| node_app
node_app -->|"reads and saves"| node_storage
node_app -->|"controls"| node_timer
node_timer -->|"reads settings"| node_storage
node_timer -->|"plays completion cues"| node_feedback
node_feedback -->|"reads settings"| node_storage
node_app -.->|"renders catalog"| node_catalog
node_schedule -->|"reads schedule and templates"| node_storage
node_app -.->|"gets workout schedule"| node_schedule
node_analytics -->|"reads history and settings"| node_storage
node_app -->|"renders analytics"| node_analytics
node_storage -->|"persists app data"| node_localstore
node_browser -.->|"registers offline support"| node_serviceworker
node_serviceworker -->|"serves cached assets"| node_browser

click node_app "https://github.com/serpentmaks/workout-tracker/blob/main/js/app.js"
click node_catalog "https://github.com/serpentmaks/workout-tracker/blob/main/js/exercises-data.js"
click node_schedule "https://github.com/serpentmaks/workout-tracker/blob/main/js/schedule.js"
click node_timer "https://github.com/serpentmaks/workout-tracker/blob/main/js/timer.js"
click node_feedback "https://github.com/serpentmaks/workout-tracker/blob/main/js/audio.js"
click node_analytics "https://github.com/serpentmaks/workout-tracker/blob/main/js/analytics.js"
click node_storage "https://github.com/serpentmaks/workout-tracker/blob/main/js/storage.js"
click node_serviceworker "https://github.com/serpentmaks/workout-tracker/blob/main/sw.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_timer,node_feedback,node_user,node_browser toneBlue
class node_catalog,node_schedule toneAmber
class node_analytics toneMint
class node_storage,node_localstore,node_serviceworker toneRose
```

## Components

### Workout Tracking

- [Workout app controller](https://github.com/serpentmaks/workout-tracker/blob/main/js/app.js): `js/app.js`
- [Rest timer](https://github.com/serpentmaks/workout-tracker/blob/main/js/timer.js): `js/timer.js`
- [Audio & haptics](https://github.com/serpentmaks/workout-tracker/blob/main/js/audio.js): `js/audio.js`

### Plans & Exercise Data

- [Exercise catalog data](https://github.com/serpentmaks/workout-tracker/blob/main/js/exercises-data.js): `js/exercises-data.js`
- [Cycle scheduler](https://github.com/serpentmaks/workout-tracker/blob/main/js/schedule.js): `js/schedule.js`

### History & Profile

- [History & analytics](https://github.com/serpentmaks/workout-tracker/blob/main/js/analytics.js): `js/analytics.js`

### App Runtime

- [Local state manager](https://github.com/serpentmaks/workout-tracker/blob/main/js/storage.js): `js/storage.js`
- **Browser local storage**
- [Offline service worker](https://github.com/serpentmaks/workout-tracker/blob/main/sw.js): `sw.js`

### Other components

- **iPhone user**
- **iPhone browser**

## Connections

- iPhone user → Workout app controller: uses (evidence: `js/app.js`)
- Workout app controller → Local state manager: reads and saves (evidence: `js/app.js`)
- Workout app controller → Rest timer: controls (evidence: `js/app.js`)
- Rest timer → Local state manager: reads settings (evidence: `js/timer.js`)
- Rest timer → Audio & haptics: plays completion cues (evidence: `js/timer.js`)
- Audio & haptics → Local state manager: reads settings (evidence: `js/audio.js`)
- Workout app controller → Exercise catalog data: renders catalog
- Cycle scheduler → Local state manager: reads schedule and templates (evidence: `js/schedule.js`)
- Workout app controller → Cycle scheduler: gets workout schedule
- History & analytics → Local state manager: reads history and settings (evidence: `js/analytics.js`)
- Workout app controller → History & analytics: renders analytics (evidence: `js/app.js`)
- Local state manager → Browser local storage: persists app data (evidence: `js/storage.js`)
- iPhone browser → Offline service worker: registers offline support
- Offline service worker → iPhone browser: serves cached assets (evidence: `sw.js`)
