# santonear/fitness architecture

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

## Overview

Fitness is a mobile-first, bilingual local workout planner and tracker. A user navigates the SPA to create plans or start a temporary/planned workout, records sets, reviews actual values before completion, then consults read-only history and trends. Settings cover optional profile preferences, body weight, training memo, and JSON backup/restore; catalog and timer support exercise selection and timed training. IndexedDB is the local source of truth. The graph follows documented capabilities and shown references; unsampled modules are included where the tree and README establish them, but their internal call paths are not inferred.

Main entry points: [`src/persistence/repository.ts`](https://github.com/santonear/fitness/blob/main/src/persistence/repository.ts) (Repository transactions), [`src/ui/App.tsx`](https://github.com/santonear/fitness/blob/main/src/ui/App.tsx) (SPA navigation), [`src/ui/pages/WorkoutPage.tsx`](https://github.com/santonear/fitness/blob/main/src/ui/pages/WorkoutPage.tsx) (Workout flow), [`src/catalog/exercises.ts`](https://github.com/santonear/fitness/blob/main/src/catalog/exercises.ts) (Exercise catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["SPA navigation<br/>[App.tsx]"]
  node_today["Today dashboard<br/>[TodayPage.tsx]"]
  node_workout_ui["Workout flow<br/>[WorkoutPage.tsx]"]
  node_review["Completion review"]
  node_catalog_ui["Exercise catalog UI<br/>[CatalogPage.tsx]"]
  node_timer_ui["Timer controls<br/>[WorkoutTimer.tsx]"]
end

subgraph group_training["Planning and training"]
  node_catalog["Exercise catalog<br/>[exercises.ts]"]
  node_plans_ui["Plan management<br/>[PlansPage.tsx]"]
  node_plan_editor["Plan editor<br/>[PlanEditor.tsx]"]
  node_day_plans_ui["Day plan editor<br/>[DayPlansPanel.tsx]"]
  node_plans["Plan services<br/>[plans.ts]"]
  node_day_plans["Day scheduling<br/>[day-plans.ts]"]
  node_workouts["Workout services<br/>[workouts.ts]"]
  node_timers["Workout timers<br/>[timers.ts]"]
end

subgraph group_insights["History and settings"]
  node_progress_ui["Progress page<br/>[ProgressPage.tsx]"]
  node_progress["History and trends<br/>[progress.ts]"]
  node_history_detail["History detail<br/>[HistoryDetail.tsx]"]
  node_settings["Settings page<br/>[SettingsPage.tsx]"]
  node_profile["Profile preferences<br/>[profile.ts]"]
  node_body_weight["Body-weight tracking<br/>[body-weight.ts]"]
  node_memo["Training memo<br/>[training-memory.ts]"]
  node_backup_ui["Backup panel<br/>[BackupPanel.tsx]"]
  node_backup["JSON backup and restore<br/>[backup.ts]"]
end

subgraph group_foundation["Local data foundation"]
  node_db[("IndexedDB<br/>[db.ts]")]
  node_repository["Repository transactions<br/>[repository.ts]"]
  node_domain["Domain contracts<br/>[schemas.ts]"]
  node_calendar["Calendar projection"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_today
node_app -->|"routes to"| node_workout_ui
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_plans_ui
node_app -->|"routes to"| node_progress_ui
node_app -->|"routes to"| node_settings
node_today -->|"opens"| node_workout_ui
node_today -->|"queries"| node_workouts
node_today -->|"queries"| node_progress
node_workout_ui -->|"records"| node_workouts
node_workout_ui -->|"renders"| node_review
node_workout_ui -->|"selects exercises"| node_catalog
node_workout_ui -->|"reads preferences"| node_profile
node_workout_ui -.->|"uses"| node_timers
node_timer_ui -.->|"controls"| node_timers
node_catalog_ui -->|"displays"| node_catalog
node_plans_ui -->|"manages"| node_plans
node_plans_ui -->|"renders"| node_day_plans_ui
node_plans_ui -->|"renders"| node_plan_editor
node_plans_ui -->|"reads"| node_profile
node_plan_editor -->|"selects exercises"| node_catalog
node_plans -->|"validates against"| node_catalog
node_plans -->|"uses projection"| node_calendar
node_day_plans -->|"projects dates"| node_calendar
node_workouts -->|"synchronizes"| node_memo
node_workouts -->|"snapshots exercises"| node_catalog
node_progress_ui -->|"loads reports"| node_progress
node_progress_ui -->|"renders"| node_history_detail
node_progress -.->|"resolves exercise data"| node_catalog
node_settings -->|"updates"| node_profile
node_settings -->|"records"| node_body_weight
node_settings -->|"reads"| node_memo
node_settings -->|"renders"| node_backup_ui
node_backup_ui -.->|"imports and exports"| node_backup
node_backup -->|"rebuilds memo"| node_memo
node_backup -->|"validates catalog"| node_catalog
node_repository -->|"transacts"| node_db
node_repository -->|"uses metadata types"| node_domain
node_db -->|"validates stored data"| node_domain
node_profile -->|"reads and writes"| node_repository
node_plans -.->|"reads and writes"| node_repository
node_day_plans -->|"reads and writes"| node_repository
node_workouts -->|"reads and writes"| node_repository
node_progress -->|"reads"| node_repository
node_backup -->|"replaces data"| node_repository
node_backup -->|"projects dates"| node_calendar

click node_app "https://github.com/santonear/fitness/blob/main/src/ui/App.tsx"
click node_today "https://github.com/santonear/fitness/blob/main/src/ui/pages/TodayPage.tsx"
click node_workout_ui "https://github.com/santonear/fitness/blob/main/src/ui/pages/WorkoutPage.tsx"
click node_review "https://github.com/santonear/fitness/blob/main/src/ui/components/CompletionReview.tsx"
click node_catalog_ui "https://github.com/santonear/fitness/blob/main/src/ui/pages/CatalogPage.tsx"
click node_catalog "https://github.com/santonear/fitness/blob/main/src/catalog/exercises.ts"
click node_plans_ui "https://github.com/santonear/fitness/blob/main/src/ui/pages/PlansPage.tsx"
click node_plan_editor "https://github.com/santonear/fitness/blob/main/src/ui/components/PlanEditor.tsx"
click node_day_plans_ui "https://github.com/santonear/fitness/blob/main/src/ui/components/DayPlansPanel.tsx"
click node_plans "https://github.com/santonear/fitness/blob/main/src/application/plans.ts"
click node_day_plans "https://github.com/santonear/fitness/blob/main/src/application/day-plans.ts"
click node_workouts "https://github.com/santonear/fitness/blob/main/src/application/workouts.ts"
click node_timers "https://github.com/santonear/fitness/blob/main/src/application/timers.ts"
click node_timer_ui "https://github.com/santonear/fitness/blob/main/src/ui/components/WorkoutTimer.tsx"
click node_progress_ui "https://github.com/santonear/fitness/blob/main/src/ui/pages/ProgressPage.tsx"
click node_progress "https://github.com/santonear/fitness/blob/main/src/application/progress.ts"
click node_history_detail "https://github.com/santonear/fitness/blob/main/src/ui/components/HistoryDetail.tsx"
click node_settings "https://github.com/santonear/fitness/blob/main/src/ui/pages/SettingsPage.tsx"
click node_profile "https://github.com/santonear/fitness/blob/main/src/application/profile.ts"
click node_body_weight "https://github.com/santonear/fitness/blob/main/src/application/body-weight.ts"
click node_memo "https://github.com/santonear/fitness/blob/main/src/application/training-memory.ts"
click node_backup_ui "https://github.com/santonear/fitness/blob/main/src/ui/components/BackupPanel.tsx"
click node_backup "https://github.com/santonear/fitness/blob/main/src/application/backup.ts"
click node_db "https://github.com/santonear/fitness/blob/main/src/persistence/db.ts"
click node_repository "https://github.com/santonear/fitness/blob/main/src/persistence/repository.ts"
click node_domain "https://github.com/santonear/fitness/blob/main/src/domain/schemas.ts"
click node_calendar "https://github.com/santonear/fitness/blob/main/src/domain/day-date-projection.ts"

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_today,node_workout_ui,node_review,node_catalog_ui,node_timer_ui,node_user toneBlue
class node_catalog,node_plans_ui,node_plan_editor,node_day_plans_ui,node_plans,node_day_plans,node_workouts,node_timers toneAmber
class node_progress_ui,node_progress,node_history_detail,node_settings,node_profile,node_body_weight,node_memo,node_backup_ui,node_backup toneMint
class node_db,node_repository,node_domain,node_calendar toneRose
```

## Components

### App experience

- [SPA navigation](https://github.com/santonear/fitness/blob/main/src/ui/App.tsx): `src/ui/App.tsx`
- [Today dashboard](https://github.com/santonear/fitness/blob/main/src/ui/pages/TodayPage.tsx): `src/ui/pages/TodayPage.tsx`
- [Workout flow](https://github.com/santonear/fitness/blob/main/src/ui/pages/WorkoutPage.tsx): `src/ui/pages/WorkoutPage.tsx`
- [Completion review](https://github.com/santonear/fitness/blob/main/src/ui/components/CompletionReview.tsx): `src/ui/components/CompletionReview.tsx`
- [Exercise catalog UI](https://github.com/santonear/fitness/blob/main/src/ui/pages/CatalogPage.tsx): `src/ui/pages/CatalogPage.tsx`
- [Timer controls](https://github.com/santonear/fitness/blob/main/src/ui/components/WorkoutTimer.tsx): `src/ui/components/WorkoutTimer.tsx`

### Planning and training

- [Exercise catalog](https://github.com/santonear/fitness/blob/main/src/catalog/exercises.ts): `src/catalog/exercises.ts`
- [Plan management](https://github.com/santonear/fitness/blob/main/src/ui/pages/PlansPage.tsx): `src/ui/pages/PlansPage.tsx`
- [Plan editor](https://github.com/santonear/fitness/blob/main/src/ui/components/PlanEditor.tsx): `src/ui/components/PlanEditor.tsx`
- [Day plan editor](https://github.com/santonear/fitness/blob/main/src/ui/components/DayPlansPanel.tsx): `src/ui/components/DayPlansPanel.tsx`
- [Plan services](https://github.com/santonear/fitness/blob/main/src/application/plans.ts): `src/application/plans.ts`
- [Day scheduling](https://github.com/santonear/fitness/blob/main/src/application/day-plans.ts): `src/application/day-plans.ts`
- [Workout services](https://github.com/santonear/fitness/blob/main/src/application/workouts.ts): `src/application/workouts.ts`
- [Workout timers](https://github.com/santonear/fitness/blob/main/src/application/timers.ts): `src/application/timers.ts`

### History and settings

- [Progress page](https://github.com/santonear/fitness/blob/main/src/ui/pages/ProgressPage.tsx): `src/ui/pages/ProgressPage.tsx`
- [History and trends](https://github.com/santonear/fitness/blob/main/src/application/progress.ts): `src/application/progress.ts`
- [History detail](https://github.com/santonear/fitness/blob/main/src/ui/components/HistoryDetail.tsx): `src/ui/components/HistoryDetail.tsx`
- [Settings page](https://github.com/santonear/fitness/blob/main/src/ui/pages/SettingsPage.tsx): `src/ui/pages/SettingsPage.tsx`
- [Profile preferences](https://github.com/santonear/fitness/blob/main/src/application/profile.ts): `src/application/profile.ts`
- [Body-weight tracking](https://github.com/santonear/fitness/blob/main/src/application/body-weight.ts): `src/application/body-weight.ts`
- [Training memo](https://github.com/santonear/fitness/blob/main/src/application/training-memory.ts): `src/application/training-memory.ts`
- [Backup panel](https://github.com/santonear/fitness/blob/main/src/ui/components/BackupPanel.tsx): `src/ui/components/BackupPanel.tsx`
- [JSON backup and restore](https://github.com/santonear/fitness/blob/main/src/application/backup.ts): `src/application/backup.ts`

### Local data foundation

- [IndexedDB](https://github.com/santonear/fitness/blob/main/src/persistence/db.ts): `src/persistence/db.ts`
- [Repository transactions](https://github.com/santonear/fitness/blob/main/src/persistence/repository.ts): `src/persistence/repository.ts`
- [Domain contracts](https://github.com/santonear/fitness/blob/main/src/domain/schemas.ts): `src/domain/schemas.ts`
- [Calendar projection](https://github.com/santonear/fitness/blob/main/src/domain/day-date-projection.ts): `src/domain/day-date-projection.ts`

### Other components

- **User**

## Connections

- User → SPA navigation: uses (evidence: `src/ui/App.tsx`)
- SPA navigation → Today dashboard: routes to (evidence: `src/ui/App.tsx`)
- SPA navigation → Workout flow: routes to (evidence: `src/ui/App.tsx`)
- SPA navigation → Exercise catalog UI: routes to (evidence: `src/ui/App.tsx`)
- SPA navigation → Plan management: routes to (evidence: `src/ui/App.tsx`)
- SPA navigation → Progress page: routes to (evidence: `src/ui/App.tsx`)
- SPA navigation → Settings page: routes to (evidence: `src/ui/App.tsx`)
- Today dashboard → Workout flow: opens (evidence: `src/ui/pages/TodayPage.tsx`)
- Today dashboard → Workout services: queries (evidence: `src/ui/pages/TodayPage.tsx`)
- Today dashboard → History and trends: queries (evidence: `src/ui/pages/TodayPage.tsx`)
- Workout flow → Workout services: records (evidence: `src/ui/pages/WorkoutPage.tsx`)
- Workout flow → Completion review: renders (evidence: `src/ui/pages/WorkoutPage.tsx`)
- Workout flow → Exercise catalog: selects exercises (evidence: `src/ui/pages/WorkoutPage.tsx`)
- Workout flow → Profile preferences: reads preferences (evidence: `src/ui/pages/WorkoutPage.tsx`)
- Workout flow → Workout timers: uses
- Timer controls → Workout timers: controls
- Exercise catalog UI → Exercise catalog: displays (evidence: `src/ui/pages/CatalogPage.tsx`)
- Plan management → Plan services: manages (evidence: `src/ui/pages/PlansPage.tsx`)
- Plan management → Day plan editor: renders (evidence: `src/ui/pages/PlansPage.tsx`)
- Plan management → Plan editor: renders (evidence: `src/ui/pages/PlansPage.tsx`)
- Plan management → Profile preferences: reads (evidence: `src/ui/pages/PlansPage.tsx`)
- Plan editor → Exercise catalog: selects exercises (evidence: `src/ui/components/PlanEditor.tsx`)
- Plan services → Exercise catalog: validates against (evidence: `src/application/plans.ts`)
- Plan services → Calendar projection: uses projection (evidence: `src/application/plans.ts`)
- Day scheduling → Calendar projection: projects dates (evidence: `src/application/day-plans.ts`)
- Workout services → Training memo: synchronizes (evidence: `src/application/workouts.ts`)
- Workout services → Exercise catalog: snapshots exercises (evidence: `src/application/workouts.ts`)
- Progress page → History and trends: loads reports (evidence: `src/ui/pages/ProgressPage.tsx`)
- Progress page → History detail: renders (evidence: `src/ui/pages/ProgressPage.tsx`)
- History and trends → Exercise catalog: resolves exercise data
- Settings page → Profile preferences: updates (evidence: `src/ui/pages/SettingsPage.tsx`)
- Settings page → Body-weight tracking: records (evidence: `src/ui/pages/SettingsPage.tsx`)
- Settings page → Training memo: reads (evidence: `src/ui/pages/SettingsPage.tsx`)
- Settings page → Backup panel: renders (evidence: `src/ui/pages/SettingsPage.tsx`)
- Backup panel → JSON backup and restore: imports and exports
- JSON backup and restore → Training memo: rebuilds memo (evidence: `src/application/backup.ts`)
- JSON backup and restore → Exercise catalog: validates catalog (evidence: `src/application/backup.ts`)
- Repository transactions → IndexedDB: transacts (evidence: `src/persistence/repository.ts`)
- Repository transactions → Domain contracts: uses metadata types (evidence: `src/persistence/repository.ts`)
- IndexedDB → Domain contracts: validates stored data (evidence: `src/persistence/db.ts`)
- Profile preferences → Repository transactions: reads and writes (evidence: `src/application/profile.ts`)
- Plan services → Repository transactions: reads and writes (evidence: `src/application/plans.ts`)
- Day scheduling → Repository transactions: reads and writes (evidence: `src/application/day-plans.ts`)
- Workout services → Repository transactions: reads and writes (evidence: `src/application/workouts.ts`)
- History and trends → Repository transactions: reads (evidence: `src/application/progress.ts`)
- JSON backup and restore → Repository transactions: replaces data (evidence: `src/application/backup.ts`)
- JSON backup and restore → Calendar projection: projects dates (evidence: `src/application/backup.ts`)
