# jagadeesh729/bodymap architecture

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

## Overview

BodyMap is a local-first fitness and diet planner: users enter personal, goal, health, equipment, diet, and recovery details; the app generates a structured weekly plan, then supports plan management, guided workouts, progress analytics, and data export. The graph preserves the README’s major capabilities and uses documented subsystem paths; unsampled page and API implementations limit certainty about some internal call wiring.

Main entry points: [`src/App.tsx`](https://github.com/jagadeesh729/bodymap/blob/main/src/App.tsx) (App router), [`src/pages/DashboardPage.tsx`](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/DashboardPage.tsx) (Analytics dashboard), [`src/context/PlanContext.tsx`](https://github.com/jagadeesh729/bodymap/blob/main/src/context/PlanContext.tsx) (Plan state), [`src/pages/GymModePage.tsx`](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/GymModePage.tsx) (Gym mode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_app["App router<br/>[App.tsx]"]
end

subgraph group_planning["Plan generation"]
  node_wizard["Plan wizard<br/>[CreatePlanPage.tsx]"]
  node_plan_context["Plan state<br/>[PlanContext.tsx]"]
  node_plan_storage[("Plan persistence<br/>[planStorage.ts]")]
  node_plan_api["Plan API<br/>[generate-plan.ts]"]
  node_plan_schema["Plan schema<br/>[planSchema.ts]"]
  node_safety["Safety guards<br/>[planSafetyGate.ts]"]
  node_weekly["Weekly plan<br/>[WeeklyPlanPage.tsx]"]
  node_plan_library[("Plan library")]
  node_comparison["Plan comparison"]
end

subgraph group_training["Workout tracking"]
  node_gym["Gym mode<br/>[GymModePage.tsx]"]
  node_checkpoint[("Session checkpoint")]
  node_session_storage[("Workout history<br/>[sessionStorage.ts]")]
  node_debrief["Session debrief<br/>[sessionDebrief.ts]"]
end

subgraph group_analytics["Athlete analytics"]
  node_dashboard["Analytics dashboard<br/>[DashboardPage.tsx]"]
  node_progress["Progress engines"]
  node_cross_session["Movement history"]
  node_body_metrics[("Body measurements")]
  node_body_trends["Measurement trends"]
end

subgraph group_vault["Data vault"]
  node_download["Plan and data export"]
  node_backup["Backup manager<br/>[backupStorage.ts]"]
  node_vault_integrity["Vault integrity"]
  node_vault_manifest["Vault manifest"]
end

node_athlete(("Athlete"))
node_gemini{{"Gemini AI"}}

node_athlete -->|"uses"| node_app
node_app -->|"routes to"| node_wizard
node_app -->|"routes to"| node_weekly
node_app -->|"routes to"| node_gym
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_download
node_wizard -->|"updates state"| node_plan_context
node_plan_context -->|"persists state"| node_plan_storage
node_wizard -->|"requests plan"| node_plan_api
node_plan_api -->|"requests generation"| node_gemini
node_plan_api -->|"validates response"| node_plan_schema
node_plan_schema -->|"checks plan"| node_safety
node_plan_context -->|"supplies plan"| node_weekly
node_plan_context -->|"manages saved plans"| node_plan_library
node_plan_library -->|"provides plans"| node_comparison
node_gym -->|"saves checkpoint"| node_checkpoint
node_gym -->|"records workout"| node_session_storage
node_gym -->|"captures reflection"| node_debrief
node_debrief -->|"saves reflection"| node_session_storage
node_dashboard -->|"reads history"| node_session_storage
node_dashboard -->|"calculates goals"| node_progress
node_dashboard -->|"aggregates exercises"| node_cross_session
node_dashboard -->|"reads measurements"| node_body_metrics
node_dashboard -->|"calculates trends"| node_body_trends
node_download -->|"exports and restores"| node_backup
node_backup -->|"reads and writes"| node_plan_storage
node_backup -->|"reads and writes"| node_session_storage
node_backup -->|"reads and writes"| node_body_metrics
node_download -->|"checks integrity"| node_vault_integrity
node_download -->|"indexes partitions"| node_vault_manifest

click node_app "https://github.com/jagadeesh729/bodymap/blob/main/src/App.tsx"
click node_wizard "https://github.com/jagadeesh729/bodymap/blob/main/src/pages/CreatePlanPage.tsx"
click node_plan_context "https://github.com/jagadeesh729/bodymap/blob/main/src/context/PlanContext.tsx"
click node_plan_storage "https://github.com/jagadeesh729/bodymap/blob/main/src/context/planStorage.ts"
click node_plan_api "https://github.com/jagadeesh729/bodymap/blob/main/api/generate-plan.ts"
click node_plan_schema "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planSchema.ts"
click node_safety "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planSafetyGate.ts"
click node_weekly "https://github.com/jagadeesh729/bodymap/blob/main/src/pages/WeeklyPlanPage.tsx"
click node_plan_library "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/savedPlansStorage.ts"
click node_comparison "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planComparisonEngine.ts"
click node_gym "https://github.com/jagadeesh729/bodymap/blob/main/src/pages/GymModePage.tsx"
click node_checkpoint "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/workoutCheckpointEngine.ts"
click node_session_storage "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/sessionStorage.ts"
click node_debrief "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/sessionDebrief.ts"
click node_dashboard "https://github.com/jagadeesh729/bodymap/blob/main/src/pages/DashboardPage.tsx"
click node_progress "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/goalProgressEngine.ts"
click node_cross_session "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/exerciseCrossSessionEngine.ts"
click node_body_metrics "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/bodyMetricsStorage.ts"
click node_body_trends "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/bodyMeasurementTrendEngine.ts"
click node_download "https://github.com/jagadeesh729/bodymap/blob/main/src/pages/DownloadPlanPage.tsx"
click node_backup "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/backupStorage.ts"
click node_vault_integrity "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/vaultIntegrityEngine.ts"
click node_vault_manifest "https://github.com/jagadeesh729/bodymap/blob/main/src/lib/vaultManifestEngine.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 toneBlue
class node_wizard,node_plan_context,node_plan_storage,node_plan_api,node_plan_schema,node_safety,node_weekly,node_plan_library,node_comparison toneAmber
class node_gym,node_checkpoint,node_session_storage,node_debrief toneMint
class node_dashboard,node_progress,node_cross_session,node_body_metrics,node_body_trends toneRose
class node_download,node_backup,node_vault_integrity,node_vault_manifest,node_athlete,node_gemini toneIndigo
```

## Components

### Application flow

- [App router](https://github.com/jagadeesh729/bodymap/blob/main/src/App.tsx): `src/App.tsx`

### Plan generation

- [Plan wizard](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/CreatePlanPage.tsx): `src/pages/CreatePlanPage.tsx`
- [Plan state](https://github.com/jagadeesh729/bodymap/blob/main/src/context/PlanContext.tsx): `src/context/PlanContext.tsx`
- [Plan persistence](https://github.com/jagadeesh729/bodymap/blob/main/src/context/planStorage.ts): `src/context/planStorage.ts`
- [Plan API](https://github.com/jagadeesh729/bodymap/blob/main/api/generate-plan.ts): `api/generate-plan.ts`
- [Plan schema](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planSchema.ts): `src/lib/planSchema.ts`
- [Safety guards](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planSafetyGate.ts): `src/lib/planSafetyGate.ts`
- [Weekly plan](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/WeeklyPlanPage.tsx): `src/pages/WeeklyPlanPage.tsx`
- [Plan library](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/savedPlansStorage.ts): `src/lib/savedPlansStorage.ts`
- [Plan comparison](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/planComparisonEngine.ts): `src/lib/planComparisonEngine.ts`

### Workout tracking

- [Gym mode](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/GymModePage.tsx): `src/pages/GymModePage.tsx`
- [Session checkpoint](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/workoutCheckpointEngine.ts): `src/lib/workoutCheckpointEngine.ts`
- [Workout history](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/sessionStorage.ts): `src/lib/sessionStorage.ts`
- [Session debrief](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/sessionDebrief.ts): `src/lib/sessionDebrief.ts`

### Athlete analytics

- [Analytics dashboard](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Progress engines](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/goalProgressEngine.ts): `src/lib/goalProgressEngine.ts`
- [Movement history](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/exerciseCrossSessionEngine.ts): `src/lib/exerciseCrossSessionEngine.ts`
- [Body measurements](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/bodyMetricsStorage.ts): `src/lib/bodyMetricsStorage.ts`
- [Measurement trends](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/bodyMeasurementTrendEngine.ts): `src/lib/bodyMeasurementTrendEngine.ts`

### Data vault

- [Plan and data export](https://github.com/jagadeesh729/bodymap/blob/main/src/pages/DownloadPlanPage.tsx): `src/pages/DownloadPlanPage.tsx`
- [Backup manager](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/backupStorage.ts): `src/lib/backupStorage.ts`
- [Vault integrity](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/vaultIntegrityEngine.ts): `src/lib/vaultIntegrityEngine.ts`
- [Vault manifest](https://github.com/jagadeesh729/bodymap/blob/main/src/lib/vaultManifestEngine.ts): `src/lib/vaultManifestEngine.ts`

### Other components

- **Athlete**
- **Gemini AI**

## Connections

- Athlete → App router: uses
- App router → Plan wizard: routes to
- App router → Weekly plan: routes to
- App router → Gym mode: routes to
- App router → Analytics dashboard: routes to
- App router → Plan and data export: routes to
- Plan wizard → Plan state: updates state
- Plan state → Plan persistence: persists state
- Plan wizard → Plan API: requests plan
- Plan API → Gemini AI: requests generation
- Plan API → Plan schema: validates response
- Plan schema → Safety guards: checks plan
- Plan state → Weekly plan: supplies plan
- Plan state → Plan library: manages saved plans
- Plan library → Plan comparison: provides plans
- Gym mode → Session checkpoint: saves checkpoint
- Gym mode → Workout history: records workout
- Gym mode → Session debrief: captures reflection
- Session debrief → Workout history: saves reflection
- Analytics dashboard → Workout history: reads history
- Analytics dashboard → Progress engines: calculates goals
- Analytics dashboard → Movement history: aggregates exercises
- Analytics dashboard → Body measurements: reads measurements
- Analytics dashboard → Measurement trends: calculates trends
- Plan and data export → Backup manager: exports and restores
- Backup manager → Plan persistence: reads and writes
- Backup manager → Workout history: reads and writes
- Backup manager → Body measurements: reads and writes
- Plan and data export → Vault integrity: checks integrity
- Plan and data export → Vault manifest: indexes partitions
