# deepstructured/deep-gym architecture

> Architecture diagram of the GitHub repository deepstructured/deep-gym, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deepstructured/deep-gym
- Repository: https://github.com/deepstructured/deep-gym

## Overview

DeepGym is a cross-platform workout tracker: athletes configure a profile and training week, log and reuse workouts, then review history and strength trends. The web app and Expo mobile app expose parallel product surfaces, with shared domain logic and Supabase-backed account data. The sampled code confirms Telegram OTP and OAuth session flows; most workout and analytics wiring is inferred only at the capability level from the README, so uncertain implementation-level links are omitted.

Main entry points: [`src/features/workout-form/ui/workout-form.tsx`](https://github.com/deepstructured/deep-gym/blob/main/src/features/workout-form/ui/workout-form.tsx) (Workout logging), [`src/features/auth`](https://github.com/deepstructured/deep-gym/tree/main/src/features/auth) (Sign in), [`app/page.tsx`](https://github.com/deepstructured/deep-gym/blob/main/app/page.tsx) (Web app), [`apps/mobile/app/(app)/(tabs)/index.tsx`](https://github.com/deepstructured/deep-gym/blob/main/apps/mobile/app/(app)/(tabs)/index.tsx) (Mobile app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["App surfaces"]
  node_web["Web app<br/>[page.tsx]"]
  node_mobile["Mobile app<br/>[index.tsx]"]
  node_auth["Sign in"]
  node_onboarding["Guided setup"]
  node_settings["Preferences<br/>[settings-view.tsx]"]
end

subgraph group_training["Training workflow"]
  node_workout_form["Workout logging<br/>[workout-form.tsx]"]
  node_drafts["Workout drafts<br/>[draft-sync.ts]"]
  node_workouts["Workout records<br/>[queries.ts]"]
  node_templates["Workout templates<br/>[queries.ts]"]
  node_exercise_library["Exercise library<br/>[queries.ts]"]
  node_plate_math["Plate calculator<br/>[plate-sheet.tsx]"]
end

subgraph group_insight["Progress and planning"]
  node_exercise_detail["Exercise insights"]
  node_history["Workout history<br/>[history-view.tsx]"]
  node_analytics["Training analytics<br/>[analytics.ts]"]
  node_body_weight["Body weight<br/>[queries.ts]"]
  node_schedule["Training schedule"]
end

subgraph group_platform["Shared platform"]
  node_core["Domain logic<br/>[index.ts]"]
  node_supabase["Supabase data<br/>[client.ts]"]
end

node_athlete(("Athlete"))
node_database[("Supabase")]
node_telegram["Telegram bot"]

node_athlete -->|"uses"| node_web
node_athlete -->|"uses"| node_mobile
node_web -->|"signs in"| node_auth
node_mobile -->|"signs in"| node_auth
node_web -->|"configures"| node_onboarding
node_mobile -->|"configures"| node_onboarding
node_web -->|"starts logging"| node_workout_form
node_mobile -->|"starts logging"| node_workout_form
node_workout_form -->|"saves draft"| node_drafts
node_workout_form -->|"records session"| node_workouts
node_workout_form -->|"selects exercises"| node_exercise_library
node_workout_form -->|"loads template"| node_templates
node_workout_form -->|"calculates plates"| node_plate_math
node_history -->|"reads sessions"| node_workouts
node_exercise_detail -->|"reads exercise history"| node_workouts
node_analytics -->|"analyzes sessions"| node_workouts
node_settings -->|"edits schedule"| node_schedule
node_settings -->|"records weight"| node_body_weight
node_workout_form -->|"reads latest weight"| node_body_weight
node_core -.->|"provides calculations"| node_analytics
node_auth -->|"authenticates"| node_supabase
node_supabase -->|"reads and writes"| node_database
node_auth -.->|"requests code"| node_telegram
node_telegram -.->|"delivers code"| node_auth

click node_web "https://github.com/deepstructured/deep-gym/blob/main/app/page.tsx"
click node_mobile "https://github.com/deepstructured/deep-gym/blob/main/apps/mobile/app/(app)/(tabs)/index.tsx"
click node_auth "https://github.com/deepstructured/deep-gym/tree/main/src/features/auth"
click node_onboarding "https://github.com/deepstructured/deep-gym/blob/main/src/views/onboarding/ui/onboarding-view.tsx"
click node_workout_form "https://github.com/deepstructured/deep-gym/blob/main/src/features/workout-form/ui/workout-form.tsx"
click node_drafts "https://github.com/deepstructured/deep-gym/blob/main/src/features/workout-form/model/draft-sync.ts"
click node_workouts "https://github.com/deepstructured/deep-gym/blob/main/src/entities/workout/api/queries.ts"
click node_templates "https://github.com/deepstructured/deep-gym/blob/main/src/entities/workout-template/api/queries.ts"
click node_exercise_library "https://github.com/deepstructured/deep-gym/blob/main/src/entities/exercise/api/queries.ts"
click node_exercise_detail "https://github.com/deepstructured/deep-gym/blob/main/src/features/exercise-stats/ui/progress-explorer.tsx"
click node_history "https://github.com/deepstructured/deep-gym/blob/main/src/views/history/ui/history-view.tsx"
click node_analytics "https://github.com/deepstructured/deep-gym/blob/main/src/features/training-analytics/model/analytics.ts"
click node_body_weight "https://github.com/deepstructured/deep-gym/blob/main/src/entities/body-weight/api/queries.ts"
click node_schedule "https://github.com/deepstructured/deep-gym/tree/main/src/features/training-schedule"
click node_settings "https://github.com/deepstructured/deep-gym/blob/main/src/views/settings/ui/settings-view.tsx"
click node_plate_math "https://github.com/deepstructured/deep-gym/blob/main/src/features/plate-calculator/ui/plate-sheet.tsx"
click node_core "https://github.com/deepstructured/deep-gym/blob/main/packages/core/src/index.ts"
click node_supabase "https://github.com/deepstructured/deep-gym/blob/main/src/shared/lib/supabase/client.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_web,node_mobile,node_auth,node_onboarding,node_settings toneBlue
class node_workout_form,node_drafts,node_workouts,node_templates,node_exercise_library,node_plate_math,node_database toneAmber
class node_exercise_detail,node_history,node_analytics,node_body_weight,node_schedule toneMint
class node_core,node_supabase toneRose
class node_athlete,node_telegram toneIndigo
```

## Components

### App surfaces

- [Web app](https://github.com/deepstructured/deep-gym/blob/main/app/page.tsx): `app/page.tsx`
- [Mobile app](https://github.com/deepstructured/deep-gym/blob/main/apps/mobile/app/(app)/(tabs)/index.tsx): `apps/mobile/app/(app)/(tabs)/index.tsx`
- [Sign in](https://github.com/deepstructured/deep-gym/tree/main/src/features/auth): `src/features/auth`
- [Guided setup](https://github.com/deepstructured/deep-gym/blob/main/src/views/onboarding/ui/onboarding-view.tsx): `src/views/onboarding/ui/onboarding-view.tsx`
- [Preferences](https://github.com/deepstructured/deep-gym/blob/main/src/views/settings/ui/settings-view.tsx): `src/views/settings/ui/settings-view.tsx`

### Training workflow

- [Workout logging](https://github.com/deepstructured/deep-gym/blob/main/src/features/workout-form/ui/workout-form.tsx): `src/features/workout-form/ui/workout-form.tsx`
- [Workout drafts](https://github.com/deepstructured/deep-gym/blob/main/src/features/workout-form/model/draft-sync.ts): `src/features/workout-form/model/draft-sync.ts`
- [Workout records](https://github.com/deepstructured/deep-gym/blob/main/src/entities/workout/api/queries.ts): `src/entities/workout/api/queries.ts`
- [Workout templates](https://github.com/deepstructured/deep-gym/blob/main/src/entities/workout-template/api/queries.ts): `src/entities/workout-template/api/queries.ts`
- [Exercise library](https://github.com/deepstructured/deep-gym/blob/main/src/entities/exercise/api/queries.ts): `src/entities/exercise/api/queries.ts`
- [Plate calculator](https://github.com/deepstructured/deep-gym/blob/main/src/features/plate-calculator/ui/plate-sheet.tsx): `src/features/plate-calculator/ui/plate-sheet.tsx`

### Progress and planning

- [Exercise insights](https://github.com/deepstructured/deep-gym/blob/main/src/features/exercise-stats/ui/progress-explorer.tsx): `src/features/exercise-stats/ui/progress-explorer.tsx`
- [Workout history](https://github.com/deepstructured/deep-gym/blob/main/src/views/history/ui/history-view.tsx): `src/views/history/ui/history-view.tsx`
- [Training analytics](https://github.com/deepstructured/deep-gym/blob/main/src/features/training-analytics/model/analytics.ts): `src/features/training-analytics/model/analytics.ts`
- [Body weight](https://github.com/deepstructured/deep-gym/blob/main/src/entities/body-weight/api/queries.ts): `src/entities/body-weight/api/queries.ts`
- [Training schedule](https://github.com/deepstructured/deep-gym/tree/main/src/features/training-schedule): `src/features/training-schedule`

### Shared platform

- [Domain logic](https://github.com/deepstructured/deep-gym/blob/main/packages/core/src/index.ts): `packages/core/src/index.ts`
- [Supabase data](https://github.com/deepstructured/deep-gym/blob/main/src/shared/lib/supabase/client.ts): `src/shared/lib/supabase/client.ts`

### Other components

- **Athlete**
- **Supabase**
- **Telegram bot**

## Connections

- Athlete → Web app: uses
- Athlete → Mobile app: uses
- Web app → Sign in: signs in
- Mobile app → Sign in: signs in
- Web app → Guided setup: configures
- Mobile app → Guided setup: configures
- Web app → Workout logging: starts logging
- Mobile app → Workout logging: starts logging
- Workout logging → Workout drafts: saves draft
- Workout logging → Workout records: records session
- Workout logging → Exercise library: selects exercises
- Workout logging → Workout templates: loads template
- Workout logging → Plate calculator: calculates plates
- Workout history → Workout records: reads sessions
- Exercise insights → Workout records: reads exercise history
- Training analytics → Workout records: analyzes sessions
- Preferences → Training schedule: edits schedule
- Preferences → Body weight: records weight
- Workout logging → Body weight: reads latest weight
- Domain logic → Training analytics: provides calculations
- Sign in → Supabase data: authenticates
- Supabase data → Supabase: reads and writes
- Sign in → Telegram bot: requests code
- Telegram bot → Sign in: delivers code
