# aree6/liftshift architecture

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

- Interactive diagram: https://gitdiagram.com/aree6/liftshift
- Repository: https://github.com/aree6/liftshift

## Overview

LiftShift is a browser-based workout analytics product: users import CSV/Excel logs or sync Hevy and Lyfta, then explore a merged training history and its insights locally. The main path runs from app setup and data loading through normalization and browser persistence into dashboard, exercise, history, and muscle-analysis views; Flex cards provide a shareable summary branch. A small backend proxies Hevy and Lyfta requests. Workflow links are grounded in README statements and the supplied import/reference evidence; unsampled feature internals are represented by their exact tree paths without inferring their internal calls.

Main entry points: [`frontend/App.tsx`](https://github.com/aree6/liftshift/blob/main/frontend/App.tsx) (App shell), [`frontend/hooks/auth/useAppAuth.ts`](https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/useAppAuth.ts) (Setup and auth), [`backend/src/index.ts`](https://github.com/aree6/liftshift/blob/main/backend/src/index.ts) (API routes), [`backend/src/routes/hevyRoutes.ts`](https://github.com/aree6/liftshift/blob/main/backend/src/routes/hevyRoutes.ts) (Hevy routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Import and sync"]
  node_setup["Setup and auth<br/>[useAppAuth.ts]"]
  node_startup["Startup loading"]
  node_csv["CSV import<br/>[csvParser.ts]"]
  node_hevy["Hevy sync<br/>[appAuthHevy.ts]"]
  node_lyfta["Lyfta sync<br/>[appAuthLyfta.ts]"]
end

subgraph group_core["App and data"]
  node_app["App shell<br/>[App.tsx]"]
  node_normalize["Workout normalization"]
  node_storage[("Browser storage")]
end

subgraph group_analysis["Training analytics"]
  node_analytics["Training analysis"]
  node_calendar["Date filtering"]
end

subgraph group_views["Results and sharing"]
  node_dashboard["Dashboard insights<br/>[Dashboard.tsx]"]
  node_exercise["Exercise trends<br/>[ExerciseView.tsx]"]
  node_history["Workout history<br/>[HistoryView.tsx]"]
  node_muscles["Muscle analysis<br/>[MuscleAnalysis.tsx]"]
  node_flex["Flex cards<br/>[FlexView.tsx]"]
  node_ai["AI export<br/>[AIAnalyzeModal.tsx]"]
end

subgraph group_proxy["API proxy"]
  node_backend["API routes<br/>[index.ts]"]
  node_hevyroute["Hevy routes<br/>[hevyRoutes.ts]"]
  node_hevyapi["Hevy API client<br/>[hevyApi.ts]"]
  node_lyftaroute["Lyfta routes<br/>[lyftaRoutes.ts]"]
  node_lyftaapi["Lyfta API client<br/>[lyfta.ts]"]
end

node_athlete(("Workout analyst"))

node_athlete -->|"opens"| node_app
node_app -->|"starts setup"| node_setup
node_app -->|"loads saved data"| node_startup
node_setup -->|"imports logs"| node_csv
node_setup -->|"syncs Hevy"| node_hevy
node_setup -->|"syncs Lyfta"| node_lyfta
node_hevy -.->|"requests sync"| node_backend
node_lyfta -.->|"requests sync"| node_backend
node_backend -.->|"registers routes"| node_hevyroute
node_backend -.->|"registers routes"| node_lyftaroute
node_hevyroute -->|"calls client"| node_hevyapi
node_lyftaroute -->|"calls client"| node_lyftaapi
node_hevyroute -->|"maps workouts"| node_normalize
node_lyftaroute -.->|"maps workouts"| node_normalize
node_csv -->|"provides imported data"| node_app
node_app -->|"persists preferences"| node_storage
node_startup -->|"reads saved inputs"| node_storage
node_app -->|"analyzes workouts"| node_analytics
node_analytics -.->|"filters timeframe"| node_calendar
node_app -->|"presents insights"| node_dashboard
node_app -->|"opens trends"| node_exercise
node_app -->|"opens history"| node_history
node_app -->|"opens analysis"| node_muscles
node_app -->|"opens cards"| node_flex
node_athlete -->|"requests export"| node_ai

click node_app "https://github.com/aree6/liftshift/blob/main/frontend/App.tsx"
click node_setup "https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/useAppAuth.ts"
click node_startup "https://github.com/aree6/liftshift/blob/main/frontend/app/startup/useStartupAutoLoad.ts"
click node_csv "https://github.com/aree6/liftshift/blob/main/frontend/utils/csv/csvParser.ts"
click node_hevy "https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/appAuthHevy.ts"
click node_lyfta "https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/appAuthLyfta.ts"
click node_backend "https://github.com/aree6/liftshift/blob/main/backend/src/index.ts"
click node_hevyroute "https://github.com/aree6/liftshift/blob/main/backend/src/routes/hevyRoutes.ts"
click node_hevyapi "https://github.com/aree6/liftshift/blob/main/backend/src/hevyApi.ts"
click node_lyftaroute "https://github.com/aree6/liftshift/blob/main/backend/src/routes/lyftaRoutes.ts"
click node_lyftaapi "https://github.com/aree6/liftshift/blob/main/backend/src/lyfta.ts"
click node_normalize "https://github.com/aree6/liftshift/blob/main/backend/src/mapToWorkoutSets.ts"
click node_storage "https://github.com/aree6/liftshift/blob/main/frontend/utils/storage/dataSourceStorage.ts"
click node_analytics "https://github.com/aree6/liftshift/blob/main/frontend/utils/analysis/masterAlgorithm/masterAlgorithmSession.ts"
click node_dashboard "https://github.com/aree6/liftshift/blob/main/frontend/components/dashboard/ui/Dashboard.tsx"
click node_exercise "https://github.com/aree6/liftshift/blob/main/frontend/components/exerciseView/ui/ExerciseView.tsx"
click node_history "https://github.com/aree6/liftshift/blob/main/frontend/components/historyView/ui/HistoryView.tsx"
click node_muscles "https://github.com/aree6/liftshift/blob/main/frontend/components/muscleAnalysis/ui/MuscleAnalysis.tsx"
click node_flex "https://github.com/aree6/liftshift/blob/main/frontend/components/flexView/ui/FlexView.tsx"
click node_calendar "https://github.com/aree6/liftshift/blob/main/frontend/hooks/app/useAppCalendarFilters.ts"
click node_ai "https://github.com/aree6/liftshift/blob/main/frontend/components/modals/aiAnalyze/AIAnalyzeModal.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_setup,node_startup,node_csv,node_hevy,node_lyfta toneBlue
class node_app,node_normalize,node_storage toneAmber
class node_analytics,node_calendar toneMint
class node_dashboard,node_exercise,node_history,node_muscles,node_flex,node_ai toneRose
class node_backend,node_hevyroute,node_hevyapi,node_lyftaroute,node_lyftaapi,node_athlete toneIndigo
```

## Components

### Import and sync

- [Setup and auth](https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/useAppAuth.ts): `frontend/hooks/auth/useAppAuth.ts`
- [Startup loading](https://github.com/aree6/liftshift/blob/main/frontend/app/startup/useStartupAutoLoad.ts): `frontend/app/startup/useStartupAutoLoad.ts`
- [CSV import](https://github.com/aree6/liftshift/blob/main/frontend/utils/csv/csvParser.ts): `frontend/utils/csv/csvParser.ts`
- [Hevy sync](https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/appAuthHevy.ts): `frontend/hooks/auth/appAuthHevy.ts`
- [Lyfta sync](https://github.com/aree6/liftshift/blob/main/frontend/hooks/auth/appAuthLyfta.ts): `frontend/hooks/auth/appAuthLyfta.ts`

### App and data

- [App shell](https://github.com/aree6/liftshift/blob/main/frontend/App.tsx): `frontend/App.tsx`
- [Workout normalization](https://github.com/aree6/liftshift/blob/main/backend/src/mapToWorkoutSets.ts): `backend/src/mapToWorkoutSets.ts`
- [Browser storage](https://github.com/aree6/liftshift/blob/main/frontend/utils/storage/dataSourceStorage.ts): `frontend/utils/storage/dataSourceStorage.ts`

### Training analytics

- [Training analysis](https://github.com/aree6/liftshift/blob/main/frontend/utils/analysis/masterAlgorithm/masterAlgorithmSession.ts): `frontend/utils/analysis/masterAlgorithm/masterAlgorithmSession.ts`
- [Date filtering](https://github.com/aree6/liftshift/blob/main/frontend/hooks/app/useAppCalendarFilters.ts): `frontend/hooks/app/useAppCalendarFilters.ts`

### Results and sharing

- [Dashboard insights](https://github.com/aree6/liftshift/blob/main/frontend/components/dashboard/ui/Dashboard.tsx): `frontend/components/dashboard/ui/Dashboard.tsx`
- [Exercise trends](https://github.com/aree6/liftshift/blob/main/frontend/components/exerciseView/ui/ExerciseView.tsx): `frontend/components/exerciseView/ui/ExerciseView.tsx`
- [Workout history](https://github.com/aree6/liftshift/blob/main/frontend/components/historyView/ui/HistoryView.tsx): `frontend/components/historyView/ui/HistoryView.tsx`
- [Muscle analysis](https://github.com/aree6/liftshift/blob/main/frontend/components/muscleAnalysis/ui/MuscleAnalysis.tsx): `frontend/components/muscleAnalysis/ui/MuscleAnalysis.tsx`
- [Flex cards](https://github.com/aree6/liftshift/blob/main/frontend/components/flexView/ui/FlexView.tsx): `frontend/components/flexView/ui/FlexView.tsx`
- [AI export](https://github.com/aree6/liftshift/blob/main/frontend/components/modals/aiAnalyze/AIAnalyzeModal.tsx): `frontend/components/modals/aiAnalyze/AIAnalyzeModal.tsx`

### API proxy

- [API routes](https://github.com/aree6/liftshift/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Hevy routes](https://github.com/aree6/liftshift/blob/main/backend/src/routes/hevyRoutes.ts): `backend/src/routes/hevyRoutes.ts`
- [Hevy API client](https://github.com/aree6/liftshift/blob/main/backend/src/hevyApi.ts): `backend/src/hevyApi.ts`
- [Lyfta routes](https://github.com/aree6/liftshift/blob/main/backend/src/routes/lyftaRoutes.ts): `backend/src/routes/lyftaRoutes.ts`
- [Lyfta API client](https://github.com/aree6/liftshift/blob/main/backend/src/lyfta.ts): `backend/src/lyfta.ts`

### Other components

- **Workout analyst**

## Connections

- Workout analyst → App shell: opens (evidence: `README.md`)
- App shell → Setup and auth: starts setup (evidence: `frontend/App.tsx`)
- App shell → Startup loading: loads saved data (evidence: `frontend/App.tsx`)
- Setup and auth → CSV import: imports logs (evidence: `README.md`)
- Setup and auth → Hevy sync: syncs Hevy
- Setup and auth → Lyfta sync: syncs Lyfta
- Hevy sync → API routes: requests sync
- Lyfta sync → API routes: requests sync
- API routes → Hevy routes: registers routes
- API routes → Lyfta routes: registers routes
- Hevy routes → Hevy API client: calls client (evidence: `backend/src/routes/hevyRoutes.ts`)
- Lyfta routes → Lyfta API client: calls client (evidence: `backend/src/routes/lyftaRoutes.ts`)
- Hevy routes → Workout normalization: maps workouts (evidence: `backend/src/routes/hevyRoutes.ts`)
- Lyfta routes → Workout normalization: maps workouts
- CSV import → App shell: provides imported data (evidence: `README.md`)
- App shell → Browser storage: persists preferences (evidence: `frontend/App.tsx`)
- Startup loading → Browser storage: reads saved inputs (evidence: `frontend/app/startup/useStartupAutoLoad.ts`)
- App shell → Training analysis: analyzes workouts (evidence: `README.md`)
- Training analysis → Date filtering: filters timeframe
- App shell → Dashboard insights: presents insights (evidence: `README.md`)
- App shell → Exercise trends: opens trends
- App shell → Workout history: opens history
- App shell → Muscle analysis: opens analysis
- App shell → Flex cards: opens cards
- Workout analyst → AI export: requests export (evidence: `README.md`)
