# ivanmarksjr/treino-livre architecture

> Architecture diagram of the GitHub repository ivanmarksjr/treino-livre, 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/ivanmarksjr/treino-livre
- Repository: https://github.com/ivanmarksjr/treino-livre

## Overview

Treino Livre is a browser-based home-workout planner and tracker. Users choose or adjust a routine, follow exercise instructions and timed/repetition-based sessions, then review workout history and progress; state is stored locally in IndexedDB. The app also provides offline caching and optional video demonstrations. The excerpts show app.js as the central UI, workout, and persistence orchestrator and data.js as its exercise and routine catalog. Other UI renderers and progression details are described only by partial excerpts, so their internal links are limited to documented or visible behavior.

Main entry points: [`app.js`](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js) (App UI and actions), [`sw.js`](https://github.com/ivanmarksjr/treino-livre/blob/main/sw.js) (Service worker), [`data.js`](https://github.com/ivanmarksjr/treino-livre/blob/main/data.js) (Exercise catalog), [`videos.json`](https://github.com/ivanmarksjr/treino-livre/blob/main/videos.json) (Exercise videos)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workout["Workout experience"]
  node_app["App UI and actions<br/>[app.js]"]
  node_session["Workout session<br/>[app.js]"]
  node_history["History and progress<br/>[app.js]"]
  node_cycle["Cycle guidance<br/>[app.js]"]
end

subgraph group_catalog["Exercise and plans"]
  node_exercise["Exercise catalog<br/>[data.js]"]
  node_routine["Routine templates<br/>[data.js]"]
  node_video["Exercise videos<br/>[videos.json]"]
end

subgraph group_storage["Local data"]
  node_state[("App state<br/>[app.js]")]
  node_indexeddb[("IndexedDB")]
end

subgraph group_offline["Offline delivery"]
  node_serviceworker["Service worker<br/>[sw.js]"]
  node_cache[("Browser cache")]
end

node_user(("Trainee"))

node_user -->|"uses"| node_app
node_app -->|"reads catalog"| node_exercise
node_app -->|"loads templates"| node_routine
node_app -->|"starts and edits"| node_session
node_app -->|"renders views"| node_history
node_app -->|"applies changes"| node_cycle
node_app -->|"updates"| node_state
node_state -->|"reads and writes"| node_indexeddb
node_app -->|"fetches mappings"| node_video
node_app -->|"registers"| node_serviceworker
node_serviceworker -->|"caches responses"| node_cache

click node_app "https://github.com/ivanmarksjr/treino-livre/blob/main/app.js"
click node_session "https://github.com/ivanmarksjr/treino-livre/blob/main/app.js"
click node_history "https://github.com/ivanmarksjr/treino-livre/blob/main/app.js"
click node_cycle "https://github.com/ivanmarksjr/treino-livre/blob/main/app.js"
click node_exercise "https://github.com/ivanmarksjr/treino-livre/blob/main/data.js"
click node_routine "https://github.com/ivanmarksjr/treino-livre/blob/main/data.js"
click node_video "https://github.com/ivanmarksjr/treino-livre/blob/main/videos.json"
click node_state "https://github.com/ivanmarksjr/treino-livre/blob/main/app.js"
click node_serviceworker "https://github.com/ivanmarksjr/treino-livre/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_session,node_history,node_cycle toneBlue
class node_exercise,node_routine,node_video toneAmber
class node_state,node_indexeddb toneMint
class node_serviceworker,node_cache toneRose
class node_user toneIndigo
```

## Components

### Workout experience

- [App UI and actions](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js): `app.js`
- [Workout session](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js): `app.js`
- [History and progress](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js): `app.js`
- [Cycle guidance](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js): `app.js`

### Exercise and plans

- [Exercise catalog](https://github.com/ivanmarksjr/treino-livre/blob/main/data.js): `data.js`
- [Routine templates](https://github.com/ivanmarksjr/treino-livre/blob/main/data.js): `data.js`
- [Exercise videos](https://github.com/ivanmarksjr/treino-livre/blob/main/videos.json): `videos.json`

### Local data

- [App state](https://github.com/ivanmarksjr/treino-livre/blob/main/app.js): `app.js`
- **IndexedDB**

### Offline delivery

- [Service worker](https://github.com/ivanmarksjr/treino-livre/blob/main/sw.js): `sw.js`
- **Browser cache**

### Other components

- **Trainee**

## Connections

- Trainee → App UI and actions: uses (evidence: `app.js`)
- App UI and actions → Exercise catalog: reads catalog (evidence: `app.js`)
- App UI and actions → Routine templates: loads templates (evidence: `app.js`)
- App UI and actions → Workout session: starts and edits (evidence: `app.js`)
- App UI and actions → History and progress: renders views (evidence: `app.js`)
- App UI and actions → Cycle guidance: applies changes (evidence: `app.js`)
- App UI and actions → App state: updates (evidence: `app.js`)
- App state → IndexedDB: reads and writes (evidence: `app.js`)
- App UI and actions → Exercise videos: fetches mappings (evidence: `app.js`)
- App UI and actions → Service worker: registers (evidence: `app.js`)
- Service worker → Browser cache: caches responses (evidence: `sw.js`)
