# tesspitch/ai-fit-studio architecture

> Architecture diagram of the GitHub repository tesspitch/ai-fit-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tesspitch/ai-fit-studio
- Repository: https://github.com/tesspitch/ai-fit-studio

## Overview

Office Reset is a browser-based movement and stretching app for desk workers. Users sign in, complete a first-use screening, browse exercises, then enter the practice studio; camera-based pose analysis supports a shoulder-raise demo and a five-exercise Maneevej routine. Results are saved to Supabase and surfaced in workout history and overview. The graph includes the routine’s tracking and scoring layers. Source excerpts and the index establish the main frontend calls; database and auth details are included where documented in the README, but migrations were not sampled.

Main entry points: [`src/features/pose/maneevej-routine.tsx`](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-routine.tsx) (Maneevej routine), [`src/app.tsx`](https://github.com/tesspitch/ai-fit-studio/blob/main/src/app.tsx) (App routing), [`src/lib/supabase.ts`](https://github.com/tesspitch/ai-fit-studio/blob/main/src/lib/supabase.ts) (Supabase client), [`src/features/pose/studio.tsx`](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/studio.tsx) (Practice studio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and onboarding"]
  node_app["App routing<br/>[app.tsx]"]
  node_account["Account and auth<br/>[account.tsx]"]
  node_screening["Screening gate<br/>[screening-gate.tsx]"]
  node_tips["Quick tips<br/>[quick-tips.tsx]"]
  node_username_fn["Username signup<br/>[index.ts]"]
end

subgraph group_practice["Practice experience"]
  node_exercise_catalog["Exercise catalog<br/>[use-exercises.ts]"]
  node_studio["Practice studio<br/>[studio.tsx]"]
  node_reference["Reference preview"]
  node_routine["Maneevej routine"]
end

subgraph group_analysis["Pose analysis"]
  node_camera["Camera hook<br/>[use-camera.ts]"]
  node_runtime["Pose runtime<br/>[runtime.ts]"]
  node_framing["Framing quality<br/>[quality.ts]"]
  node_maneevej_tracker["Routine tracker<br/>[maneevej.ts]"]
  node_maneevej_filter["Pose filter<br/>[maneevej-filter.ts]"]
  node_phase_scoring["Phase scoring"]
  node_session["Session summary"]
  node_shoulder["Shoulder-raise analysis<br/>[shoulder-raise.ts]"]
end

subgraph group_records["Workout records"]
  node_save_routine["Save routine"]
  node_save_demo["Save demo"]
  node_overview["Workout overview"]
  node_history["Workout history<br/>[account.tsx]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_database[("Supabase data store")]
end

node_user(("User"))
node_supabase[("Supabase services")]

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_account
node_app -->|"gates workspace"| node_screening
node_app -->|"routes to"| node_studio
node_app -->|"loads catalog"| node_exercise_catalog
node_app -->|"shows overview"| node_overview
node_app -->|"opens tips"| node_tips
node_studio -->|"reads exercises"| node_exercise_catalog
node_studio -->|"launches routine"| node_routine
node_studio -->|"uses analysis"| node_shoulder
node_studio -->|"uses camera"| node_camera
node_studio -->|"renders preview"| node_reference
node_routine -->|"uses camera"| node_camera
node_routine -->|"tracks poses"| node_maneevej_tracker
node_routine -->|"filters poses"| node_maneevej_filter
node_routine -->|"measures quality"| node_phase_scoring
node_routine -->|"summarizes rounds"| node_session
node_routine -->|"renders clips"| node_reference
node_routine -->|"saves results"| node_save_routine
node_camera -->|"uses runtime"| node_runtime
node_camera -->|"checks framing"| node_framing
node_maneevej_tracker -->|"checks landmarks"| node_framing
node_maneevej_tracker -->|"measures phases"| node_phase_scoring
node_session -->|"scores rounds"| node_phase_scoring
node_account -->|"uses client"| node_supabase_client
node_account -->|"renders history"| node_history
node_account -->|"formats routine time"| node_session
node_screening -->|"reads screening"| node_supabase_client
node_save_routine -->|"writes results"| node_supabase_client
node_save_demo -->|"writes results"| node_supabase_client
node_overview -->|"loads records"| node_supabase_client
node_exercise_catalog -->|"loads exercises"| node_supabase_client
node_supabase_client -->|"connects services"| node_supabase
node_supabase -.->|"stores records"| node_database
node_account -.->|"registers username"| node_username_fn
node_username_fn -.->|"uses auth services"| node_supabase
node_supabase -.->|"authenticates"| node_user

click node_app "https://github.com/tesspitch/ai-fit-studio/blob/main/src/app.tsx"
click node_account "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/account/account.tsx"
click node_screening "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/onboarding/screening-gate.tsx"
click node_tips "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/onboarding/quick-tips.tsx"
click node_exercise_catalog "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/exercises/use-exercises.ts"
click node_studio "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/studio.tsx"
click node_reference "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/reference-preview.tsx"
click node_routine "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-routine.tsx"
click node_camera "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/use-camera.ts"
click node_runtime "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/runtime.ts"
click node_framing "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/quality.ts"
click node_maneevej_tracker "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej.ts"
click node_maneevej_filter "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-filter.ts"
click node_phase_scoring "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-scoring.ts"
click node_session "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-session.ts"
click node_shoulder "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/shoulder-raise.ts"
click node_save_routine "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/save-maneevej-routine.ts"
click node_save_demo "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/save-demo-workout.ts"
click node_overview "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/workout-overview.tsx"
click node_history "https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/account/account.tsx"
click node_supabase_client "https://github.com/tesspitch/ai-fit-studio/blob/main/src/lib/supabase.ts"
click node_database "https://github.com/tesspitch/ai-fit-studio/tree/main/supabase/migrations"
click node_username_fn "https://github.com/tesspitch/ai-fit-studio/blob/main/supabase/functions/register-username/index.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_account,node_screening,node_tips,node_username_fn,node_user toneBlue
class node_exercise_catalog,node_studio,node_reference,node_routine,node_supabase toneAmber
class node_camera,node_runtime,node_framing,node_maneevej_tracker,node_maneevej_filter,node_phase_scoring,node_session,node_shoulder toneMint
class node_save_routine,node_save_demo,node_overview,node_history,node_supabase_client,node_database toneRose
```

## Components

### Access and onboarding

- [App routing](https://github.com/tesspitch/ai-fit-studio/blob/main/src/app.tsx): `src/app.tsx`
- [Account and auth](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/account/account.tsx): `src/features/account/account.tsx`
- [Screening gate](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/onboarding/screening-gate.tsx): `src/features/onboarding/screening-gate.tsx`
- [Quick tips](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/onboarding/quick-tips.tsx): `src/features/onboarding/quick-tips.tsx`
- [Username signup](https://github.com/tesspitch/ai-fit-studio/blob/main/supabase/functions/register-username/index.ts): `supabase/functions/register-username/index.ts`

### Practice experience

- [Exercise catalog](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/exercises/use-exercises.ts): `src/features/exercises/use-exercises.ts`
- [Practice studio](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/studio.tsx): `src/features/pose/studio.tsx`
- [Reference preview](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/reference-preview.tsx): `src/features/pose/reference-preview.tsx`
- [Maneevej routine](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-routine.tsx): `src/features/pose/maneevej-routine.tsx`

### Pose analysis

- [Camera hook](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/use-camera.ts): `src/features/pose/use-camera.ts`
- [Pose runtime](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/runtime.ts): `src/features/pose/runtime.ts`
- [Framing quality](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/quality.ts): `src/features/pose/quality.ts`
- [Routine tracker](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej.ts): `src/features/pose/maneevej.ts`
- [Pose filter](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-filter.ts): `src/features/pose/maneevej-filter.ts`
- [Phase scoring](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-scoring.ts): `src/features/pose/maneevej-scoring.ts`
- [Session summary](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/maneevej-session.ts): `src/features/pose/maneevej-session.ts`
- [Shoulder-raise analysis](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/pose/shoulder-raise.ts): `src/features/pose/shoulder-raise.ts`

### Workout records

- [Save routine](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/save-maneevej-routine.ts): `src/features/workout/save-maneevej-routine.ts`
- [Save demo](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/save-demo-workout.ts): `src/features/workout/save-demo-workout.ts`
- [Workout overview](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/workout/workout-overview.tsx): `src/features/workout/workout-overview.tsx`
- [Workout history](https://github.com/tesspitch/ai-fit-studio/blob/main/src/features/account/account.tsx): `src/features/account/account.tsx`
- [Supabase client](https://github.com/tesspitch/ai-fit-studio/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Supabase data store](https://github.com/tesspitch/ai-fit-studio/tree/main/supabase/migrations): `supabase/migrations`

### Other components

- **User**
- **Supabase services**

## Connections

- User → App routing: opens app (evidence: `README.md`)
- App routing → Account and auth: routes to (evidence: `src/app.tsx`)
- App routing → Screening gate: gates workspace (evidence: `src/app.tsx`)
- App routing → Practice studio: routes to (evidence: `src/app.tsx`)
- App routing → Exercise catalog: loads catalog (evidence: `src/app.tsx`)
- App routing → Workout overview: shows overview (evidence: `src/app.tsx`)
- App routing → Quick tips: opens tips (evidence: `src/app.tsx`)
- Practice studio → Exercise catalog: reads exercises (evidence: `src/features/pose/studio.tsx`)
- Practice studio → Maneevej routine: launches routine (evidence: `src/features/pose/studio.tsx`)
- Practice studio → Shoulder-raise analysis: uses analysis (evidence: `src/features/pose/studio.tsx`)
- Practice studio → Camera hook: uses camera (evidence: `src/features/pose/studio.tsx`)
- Practice studio → Reference preview: renders preview (evidence: `src/features/pose/studio.tsx`)
- Maneevej routine → Camera hook: uses camera (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Routine tracker: tracks poses (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Pose filter: filters poses (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Phase scoring: measures quality (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Session summary: summarizes rounds (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Reference preview: renders clips (evidence: `src/features/pose/maneevej-routine.tsx`)
- Maneevej routine → Save routine: saves results (evidence: `src/features/pose/maneevej-routine.tsx`)
- Camera hook → Pose runtime: uses runtime (evidence: `src/features/pose/use-camera.ts`)
- Camera hook → Framing quality: checks framing (evidence: `src/features/pose/use-camera.ts`)
- Routine tracker → Framing quality: checks landmarks (evidence: `src/features/pose/maneevej.ts`)
- Routine tracker → Phase scoring: measures phases (evidence: `src/features/pose/maneevej.ts`)
- Session summary → Phase scoring: scores rounds (evidence: `src/features/pose/maneevej-session.ts`)
- Account and auth → Supabase client: uses client (evidence: `src/features/account/account.tsx`)
- Account and auth → Workout history: renders history (evidence: `src/features/account/account.tsx`)
- Account and auth → Session summary: formats routine time (evidence: `src/features/account/account.tsx`)
- Screening gate → Supabase client: reads screening (evidence: `src/features/onboarding/screening-gate.tsx`)
- Save routine → Supabase client: writes results (evidence: `src/features/workout/save-maneevej-routine.ts`)
- Save demo → Supabase client: writes results (evidence: `src/features/workout/save-demo-workout.ts`)
- Workout overview → Supabase client: loads records (evidence: `src/features/workout/workout-overview.tsx`)
- Exercise catalog → Supabase client: loads exercises (evidence: `src/features/exercises/use-exercises.ts`)
- Supabase client → Supabase services: connects services (evidence: `src/lib/supabase.ts`)
- Supabase services → Supabase data store: stores records (evidence: `README.md`)
- Account and auth → Username signup: registers username (evidence: `README.md`)
- Username signup → Supabase services: uses auth services (evidence: `README.md`)
- Supabase services → User: authenticates (evidence: `README.md`)
