# iyiu9akhan/ph-a06-fitlog architecture

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

- Interactive diagram: https://gitdiagram.com/iyiu9akhan/ph-a06-fitlog
- Repository: https://github.com/iyiu9akhan/ph-a06-fitlog

## Overview

FitLog is a workout-browsing and personal-planning app. Users browse the library, open workout details, then add workouts to today’s plan or save them; the My Plan dashboard presents both collections for review and removal. Workout data comes from a live API with a local JSON fallback, while plan and saved state persist in browser local storage. The README also documents sorting and responsive UI; implementation details for those features were not sampled, so the graph keeps them within the dashboard rather than inventing a separate flow.

Main entry points: [`src/lib/getWorkouts.tsx`](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/lib/getWorkouts.tsx) (Workout data service), [`src/context/WorkoutPlanContext.tsx`](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/context/WorkoutPlanContext.tsx) (Workout plan context), [`src/app/my-plan/page.tsx`](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/my-plan/page.tsx) (My Plan dashboard), [`src/app/details/[detailsId]/page.tsx`](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/details/%5BdetailsId%5D/page.tsx) (Workout details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Workout discovery"]
  node_home["Workout library route<br/>[page.tsx]"]
  node_library["Workout cards<br/>[LibraryCard.tsx]"]
  node_details["Workout details<br/>[page.tsx]"]
  node_workout_data["Workout data service<br/>[getWorkouts.tsx]"]
  node_fallback["Local workout data<br/>[fitlog.json]"]
end

subgraph group_planning["Plan management"]
  node_actions["Plan and save actions<br/>[ActionBtn.tsx]"]
  node_dashboard["My Plan dashboard<br/>[page.tsx]"]
  node_stats["Plan statistics<br/>[MyPlanStats.tsx]"]
  node_tabs["Plan and saved tabs<br/>[PlanTabs.tsx]"]
  node_today["Today’s workout list<br/>[TodaysPlan.tsx]"]
  node_saved["Saved workouts<br/>[Saved.tsx]"]
end

subgraph group_state["Client state"]
  node_plan_context["Workout plan context"]
  node_storage[("Browser local storage")]
end

subgraph group_feedback["User feedback"]
  node_toast_calls["Toast notifications<br/>[ToastProvider.tsx]"]
  node_toast_ui["Toast display<br/>[Toast.tsx]"]
end

node_user(("Gym user"))
node_api["Workout API"]

node_user -->|"browses"| node_home
node_home -->|"renders"| node_library
node_library -->|"loads workouts"| node_workout_data
node_details -->|"loads workout"| node_workout_data
node_workout_data -->|"fetches"| node_api
node_workout_data -->|"reads on failure"| node_fallback
node_user -->|"opens workout"| node_details
node_details -->|"offers actions"| node_actions
node_actions -->|"adds workout"| node_plan_context
node_actions -->|"requests feedback"| node_toast_calls
node_dashboard -->|"reads and removes"| node_plan_context
node_dashboard -->|"supplies collection"| node_stats
node_dashboard -->|"supplies collections"| node_tabs
node_tabs -->|"shows plan"| node_today
node_tabs -->|"shows saved"| node_saved
node_today -->|"removes workout"| node_plan_context
node_today -->|"requests feedback"| node_toast_calls
node_plan_context -->|"loads and persists"| node_storage
node_toast_calls -->|"renders"| node_toast_ui

click node_home "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/page.tsx"
click node_library "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/library/LibraryCard.tsx"
click node_details "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/details/%5BdetailsId%5D/page.tsx"
click node_workout_data "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/lib/getWorkouts.tsx"
click node_fallback "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/public/data/fitlog.json"
click node_actions "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/details/ActionBtn.tsx"
click node_dashboard "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/my-plan/page.tsx"
click node_stats "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/MyPlanStats.tsx"
click node_tabs "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/PlanTabs.tsx"
click node_today "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/TodaysPlan.tsx"
click node_saved "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/Saved.tsx"
click node_plan_context "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/context/WorkoutPlanContext.tsx"
click node_toast_calls "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/customToast/ToastProvider.tsx"
click node_toast_ui "https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/customToast/Toast.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_home,node_library,node_details,node_workout_data,node_fallback,node_user toneBlue
class node_actions,node_dashboard,node_stats,node_tabs,node_today,node_saved toneAmber
class node_plan_context,node_storage,node_api toneMint
class node_toast_calls,node_toast_ui toneRose
```

## Components

### Workout discovery

- [Workout library route](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Workout cards](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/library/LibraryCard.tsx): `src/components/library/LibraryCard.tsx`
- [Workout details](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/details/%5BdetailsId%5D/page.tsx): `src/app/details/[detailsId]/page.tsx`
- [Workout data service](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/lib/getWorkouts.tsx): `src/lib/getWorkouts.tsx`
- [Local workout data](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/public/data/fitlog.json): `public/data/fitlog.json`

### Plan management

- [Plan and save actions](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/details/ActionBtn.tsx): `src/app/details/ActionBtn.tsx`
- [My Plan dashboard](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/app/my-plan/page.tsx): `src/app/my-plan/page.tsx`
- [Plan statistics](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/MyPlanStats.tsx): `src/components/myPlan/MyPlanStats.tsx`
- [Plan and saved tabs](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/PlanTabs.tsx): `src/components/myPlan/PlanTabs.tsx`
- [Today’s workout list](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/TodaysPlan.tsx): `src/components/myPlan/TodaysPlan.tsx`
- [Saved workouts](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/myPlan/Saved.tsx): `src/components/myPlan/Saved.tsx`

### Client state

- [Workout plan context](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/context/WorkoutPlanContext.tsx): `src/context/WorkoutPlanContext.tsx`
- **Browser local storage**

### User feedback

- [Toast notifications](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/customToast/ToastProvider.tsx): `src/components/customToast/ToastProvider.tsx`
- [Toast display](https://github.com/iyiu9akhan/ph-a06-fitlog/blob/main/src/components/customToast/Toast.tsx): `src/components/customToast/Toast.tsx`

### Other components

- **Gym user**
- **Workout API**

## Connections

- Gym user → Workout library route: browses
- Workout library route → Workout cards: renders
- Workout cards → Workout data service: loads workouts
- Workout details → Workout data service: loads workout
- Workout data service → Workout API: fetches
- Workout data service → Local workout data: reads on failure
- Gym user → Workout details: opens workout
- Workout details → Plan and save actions: offers actions
- Plan and save actions → Workout plan context: adds workout
- Plan and save actions → Toast notifications: requests feedback
- My Plan dashboard → Workout plan context: reads and removes
- My Plan dashboard → Plan statistics: supplies collection
- My Plan dashboard → Plan and saved tabs: supplies collections
- Plan and saved tabs → Today’s workout list: shows plan
- Plan and saved tabs → Saved workouts: shows saved
- Today’s workout list → Workout plan context: removes workout
- Today’s workout list → Toast notifications: requests feedback
- Workout plan context → Browser local storage: loads and persists
- Toast notifications → Toast display: renders
