# leinnarf/workout-tracker-app architecture

> Architecture diagram of the GitHub repository leinnarf/workout-tracker-app, 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/leinnarf/workout-tracker-app
- Repository: https://github.com/leinnarf/workout-tracker-app

## Overview

Workout Tracker is an offline-first Expo app whose main workflow is selecting an exercise, logging sets into an automatically managed session, and using prior performance to suggest progression. Separate tabs provide analytics, a rest timer, weight conversion, and settings for data portability and preferences. The graph follows documented tab capabilities; settings backup/export and several analytics details are README-supported but their implementation is unsampled, so those links are documented rather than source-verified.

Main entry points: [`app/(tabs)/index.tsx`](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/index.tsx) (Workout Logger), [`src/db/statsQueries.ts`](https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/statsQueries.ts) (Analytics Queries), [`app/_layout.tsx`](https://github.com/leinnarf/workout-tracker-app/blob/main/app/_layout.tsx) (App Providers), [`app/(tabs)/settings.tsx`](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/settings.tsx) (Settings & Export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workout["Workout Logging"]
  node_log["Workout Logger<br/>[index.tsx]"]
  node_exercise_editor["Exercise Editor<br/>[ExerciseModal.tsx]"]
  node_exercise_actions["Exercise Actions"]
  node_finish_workout["Finish Workout"]
  node_progression["Progression Rules<br/>[suggestNext.ts]"]
end

subgraph group_progress["Progress Analytics"]
  node_stats_view["Stats Dashboard<br/>[stats.tsx]"]
  node_stats_queries["Analytics Queries<br/>[statsQueries.ts]"]
  node_math["Strength Calculations<br/>[conversions.ts]"]
end

subgraph group_tools["Training Tools"]
  node_converter["Weight Converter<br/>[convert.tsx]"]
  node_timer_screen["Rest Timer<br/>[timer.tsx]"]
  node_timer_state["Timer State<br/>[TimerContext.tsx]"]
  node_timer_device["Keep Awake &amp; Haptics<br/>[TimerContext.tsx]"]
end

subgraph group_platform["Local Platform"]
  node_session_store[("Workout Data<br/>[queries.ts]")]
  node_db_schema[("SQLite Schema<br/>[schema.ts]")]
  node_settings["Settings &amp; Export<br/>[settings.tsx]"]
  node_demo_seed["Demo Data<br/>[seedDemoData.ts]"]
  node_theme_provider["Theme Provider<br/>[ThemeContext.tsx]"]
  node_theme_tokens["Theme Tokens<br/>[tokens.ts]"]
  node_app_root["App Providers<br/>[_layout.tsx]"]
end

node_athlete(("Athlete"))

node_athlete -->|"logs sets"| node_log
node_log -->|"reads/writes"| node_session_store
node_log -->|"requests suggestion"| node_progression
node_log -.->|"opens editor"| node_exercise_editor
node_log -.->|"opens actions"| node_exercise_actions
node_log -.->|"opens completion"| node_finish_workout
node_exercise_editor -->|"submits exercise"| node_log
node_log -.->|"navigates"| node_stats_view
node_stats_view -->|"loads analytics"| node_stats_queries
node_stats_queries -->|"queries history"| node_session_store
node_stats_queries -->|"calculates 1RM"| node_math
node_stats_queries -->|"computes readiness"| node_progression
node_athlete -->|"converts weights"| node_converter
node_converter -->|"uses conversions"| node_math
node_athlete -->|"sets rest period"| node_timer_screen
node_timer_screen -->|"controls timer"| node_timer_state
node_timer_state -->|"activates device features"| node_timer_device
node_athlete -->|"manages data"| node_settings
node_settings -.->|"backs up data"| node_session_store
node_settings -->|"loads demo data"| node_demo_seed
node_app_root -->|"initializes database"| node_db_schema
node_app_root -->|"provides timer"| node_timer_state
node_app_root -->|"provides theme"| node_theme_provider
node_theme_provider -->|"uses tokens"| node_theme_tokens

click node_log "https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/index.tsx"
click node_exercise_editor "https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/ExerciseModal.tsx"
click node_exercise_actions "https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/ExerciseActionModal.tsx"
click node_finish_workout "https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/FinishWorkoutModal.tsx"
click node_session_store "https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/queries.ts"
click node_db_schema "https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/schema.ts"
click node_progression "https://github.com/leinnarf/workout-tracker-app/blob/main/src/logic/suggestNext.ts"
click node_stats_view "https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/stats.tsx"
click node_stats_queries "https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/statsQueries.ts"
click node_math "https://github.com/leinnarf/workout-tracker-app/blob/main/src/logic/conversions.ts"
click node_converter "https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/convert.tsx"
click node_timer_screen "https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/timer.tsx"
click node_timer_state "https://github.com/leinnarf/workout-tracker-app/blob/main/src/timer/TimerContext.tsx"
click node_settings "https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/settings.tsx"
click node_demo_seed "https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/seedDemoData.ts"
click node_theme_provider "https://github.com/leinnarf/workout-tracker-app/blob/main/src/theme/ThemeContext.tsx"
click node_theme_tokens "https://github.com/leinnarf/workout-tracker-app/blob/main/src/theme/tokens.ts"
click node_app_root "https://github.com/leinnarf/workout-tracker-app/blob/main/app/_layout.tsx"
click node_timer_device "https://github.com/leinnarf/workout-tracker-app/blob/main/src/timer/TimerContext.tsx"

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_log,node_exercise_editor,node_exercise_actions,node_finish_workout,node_progression toneBlue
class node_stats_view,node_stats_queries,node_math toneAmber
class node_converter,node_timer_screen,node_timer_state,node_timer_device toneMint
class node_session_store,node_db_schema,node_settings,node_demo_seed,node_theme_provider,node_theme_tokens,node_app_root toneRose
class node_athlete toneIndigo
```

## Components

### Workout Logging

- [Workout Logger](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Exercise Editor](https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/ExerciseModal.tsx): `src/components/ExerciseModal.tsx`
- [Exercise Actions](https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/ExerciseActionModal.tsx): `src/components/ExerciseActionModal.tsx`
- [Finish Workout](https://github.com/leinnarf/workout-tracker-app/blob/main/src/components/FinishWorkoutModal.tsx): `src/components/FinishWorkoutModal.tsx`
- [Progression Rules](https://github.com/leinnarf/workout-tracker-app/blob/main/src/logic/suggestNext.ts): `src/logic/suggestNext.ts`

### Progress Analytics

- [Stats Dashboard](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/stats.tsx): `app/(tabs)/stats.tsx`
- [Analytics Queries](https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/statsQueries.ts): `src/db/statsQueries.ts`
- [Strength Calculations](https://github.com/leinnarf/workout-tracker-app/blob/main/src/logic/conversions.ts): `src/logic/conversions.ts`

### Training Tools

- [Weight Converter](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/convert.tsx): `app/(tabs)/convert.tsx`
- [Rest Timer](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/timer.tsx): `app/(tabs)/timer.tsx`
- [Timer State](https://github.com/leinnarf/workout-tracker-app/blob/main/src/timer/TimerContext.tsx): `src/timer/TimerContext.tsx`
- [Keep Awake & Haptics](https://github.com/leinnarf/workout-tracker-app/blob/main/src/timer/TimerContext.tsx): `src/timer/TimerContext.tsx`

### Local Platform

- [Workout Data](https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/queries.ts): `src/db/queries.ts`
- [SQLite Schema](https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Settings & Export](https://github.com/leinnarf/workout-tracker-app/blob/main/app/(tabs)/settings.tsx): `app/(tabs)/settings.tsx`
- [Demo Data](https://github.com/leinnarf/workout-tracker-app/blob/main/src/db/seedDemoData.ts): `src/db/seedDemoData.ts`
- [Theme Provider](https://github.com/leinnarf/workout-tracker-app/blob/main/src/theme/ThemeContext.tsx): `src/theme/ThemeContext.tsx`
- [Theme Tokens](https://github.com/leinnarf/workout-tracker-app/blob/main/src/theme/tokens.ts): `src/theme/tokens.ts`
- [App Providers](https://github.com/leinnarf/workout-tracker-app/blob/main/app/_layout.tsx): `app/_layout.tsx`

### Other components

- **Athlete**

## Connections

- Athlete → Workout Logger: logs sets
- Workout Logger → Workout Data: reads/writes (evidence: `app/(tabs)/index.tsx`)
- Workout Logger → Progression Rules: requests suggestion (evidence: `app/(tabs)/index.tsx`)
- Workout Logger → Exercise Editor: opens editor (evidence: `app/(tabs)/index.tsx`)
- Workout Logger → Exercise Actions: opens actions (evidence: `app/(tabs)/index.tsx`)
- Workout Logger → Finish Workout: opens completion (evidence: `app/(tabs)/index.tsx`)
- Exercise Editor → Workout Logger: submits exercise (evidence: `src/components/ExerciseModal.tsx`)
- Workout Logger → Stats Dashboard: navigates
- Stats Dashboard → Analytics Queries: loads analytics (evidence: `app/(tabs)/stats.tsx`)
- Analytics Queries → Workout Data: queries history (evidence: `src/db/statsQueries.ts`)
- Analytics Queries → Strength Calculations: calculates 1RM (evidence: `src/db/statsQueries.ts`)
- Analytics Queries → Progression Rules: computes readiness (evidence: `src/db/statsQueries.ts`)
- Athlete → Weight Converter: converts weights
- Weight Converter → Strength Calculations: uses conversions (evidence: `app/(tabs)/convert.tsx`)
- Athlete → Rest Timer: sets rest period
- Rest Timer → Timer State: controls timer (evidence: `app/(tabs)/timer.tsx`)
- Timer State → Keep Awake & Haptics: activates device features (evidence: `src/timer/TimerContext.tsx`)
- Athlete → Settings & Export: manages data
- Settings & Export → Workout Data: backs up data (evidence: `app/(tabs)/settings.tsx`)
- Settings & Export → Demo Data: loads demo data (evidence: `app/(tabs)/settings.tsx`)
- App Providers → SQLite Schema: initializes database (evidence: `app/_layout.tsx`)
- App Providers → Timer State: provides timer (evidence: `app/_layout.tsx`)
- App Providers → Theme Provider: provides theme (evidence: `app/_layout.tsx`)
- Theme Provider → Theme Tokens: uses tokens (evidence: `src/theme/ThemeContext.tsx`)
