# itsasarya/icarus-diet-planner architecture

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

- Interactive diagram: https://gitdiagram.com/itsasarya/icarus-diet-planner
- Repository: https://github.com/itsasarya/icarus-diet-planner

## Overview

Icarus Diet Planner is a React app for searching food options, assembling a slot-limited diet, previewing its buffs, and saving or managing presets locally. The main flow runs from the Home page through the planner controller to food selection and player setup; saved-diet management is a separate route. The graph also shows the documented search, buff data, persistence, and share-related capabilities. Relationships are limited to README statements and source-index references or excerpts; several feature components were not sampled in full.

Main entry points: [`src/pages/home.tsx`](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/home.tsx) (Planner page), [`src/components/foodGrid.tsx`](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/foodGrid.tsx) (Food search grid), [`src/lib/usePlannerController.ts`](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/usePlannerController.ts) (Planner controller), [`src/pages/savedDiets.tsx`](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/savedDiets.tsx) (Saved diets page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application routes"]
  node_app["App routes<br/>[App.tsx]"]
  node_home["Planner page<br/>[home.tsx]"]
  node_saved["Saved diets page<br/>[savedDiets.tsx]"]
  node_layout["Main layout<br/>[mainLayout.tsx]"]
end

subgraph group_planning["Diet planning"]
  node_planner["Planner controller"]
  node_grid["Food search grid<br/>[foodGrid.tsx]"]
  node_search["Search context<br/>[search-context.tsx]"]
  node_setup["Player setup<br/>[playerSetup.tsx]"]
  node_selection["Selected foods"]
  node_summary["Buff summary<br/>[buffSummary.tsx]"]
  node_sharecodec["Diet share codec<br/>[dietShare.ts]"]
  node_localhook["Local storage hook<br/>[useLocalStorage.ts]"]
end

subgraph group_catalog["Food and buffs"]
  node_fooddata["Food catalog<br/>[index.ts]"]
  node_buffdata["Buff definitions<br/>[index.ts]"]
  node_foodtypes["Food and buff types<br/>[food.ts]"]
end

subgraph group_presets["Saved diets"]
  node_snapshots["Diet share snapshot"]
  node_storageapi["Diet storage<br/>[dietStorage.ts]"]
end

node_player(("Player"))
node_browserstore[("Browser local storage")]

node_player -->|"plans diets"| node_home
node_app -->|"wraps routes"| node_layout
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_saved
node_home -->|"uses controller"| node_planner
node_home -->|"renders"| node_grid
node_home -->|"renders"| node_setup
node_grid -->|"reads query"| node_search
node_grid -->|"filters catalog"| node_fooddata
node_grid -->|"looks up effects"| node_buffdata
node_grid -->|"adds food"| node_planner
node_setup -->|"renders"| node_selection
node_setup -->|"renders"| node_summary
node_setup -->|"saves diet"| node_planner
node_planner -->|"persists selection"| node_localhook
node_localhook -->|"reads and writes"| node_browserstore
node_planner -->|"manages presets"| node_storageapi
node_storageapi -->|"reads and writes"| node_browserstore
node_saved -->|"loads and edits"| node_storageapi
node_saved -->|"shows details"| node_summary
node_saved -->|"renders"| node_snapshots
node_home -->|"parses shared diet"| node_sharecodec
node_fooddata -->|"maps records"| node_foodtypes
node_buffdata -->|"uses buff types"| node_foodtypes

click node_app "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/App.tsx"
click node_home "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/home.tsx"
click node_saved "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/savedDiets.tsx"
click node_layout "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/layouts/mainLayout.tsx"
click node_planner "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/usePlannerController.ts"
click node_grid "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/foodGrid.tsx"
click node_search "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/context/search-context.tsx"
click node_setup "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/playerSetup.tsx"
click node_selection "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/selectedFoodList.tsx"
click node_summary "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/buffSummary.tsx"
click node_fooddata "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/data/foods/index.ts"
click node_buffdata "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/data/buffs/index.ts"
click node_foodtypes "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/types/food.ts"
click node_sharecodec "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/dietShare.ts"
click node_snapshots "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/dietShareSnapshot.tsx"
click node_storageapi "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/dietStorage.ts"
click node_localhook "https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/useLocalStorage.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_home,node_saved,node_layout toneBlue
class node_planner,node_grid,node_search,node_setup,node_selection,node_summary,node_sharecodec,node_localhook,node_browserstore toneAmber
class node_fooddata,node_buffdata,node_foodtypes toneMint
class node_snapshots,node_storageapi toneRose
class node_player toneIndigo
```

## Components

### Application routes

- [App routes](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/App.tsx): `src/App.tsx`
- [Planner page](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/home.tsx): `src/pages/home.tsx`
- [Saved diets page](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/pages/savedDiets.tsx): `src/pages/savedDiets.tsx`
- [Main layout](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/layouts/mainLayout.tsx): `src/layouts/mainLayout.tsx`

### Diet planning

- [Planner controller](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/usePlannerController.ts): `src/lib/usePlannerController.ts`
- [Food search grid](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/foodGrid.tsx): `src/components/foodGrid.tsx`
- [Search context](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/context/search-context.tsx): `src/context/search-context.tsx`
- [Player setup](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/playerSetup.tsx): `src/components/playerSetup.tsx`
- [Selected foods](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/selectedFoodList.tsx): `src/components/selectedFoodList.tsx`
- [Buff summary](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/buffSummary.tsx): `src/components/buffSummary.tsx`
- [Diet share codec](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/dietShare.ts): `src/lib/dietShare.ts`
- [Local storage hook](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/useLocalStorage.ts): `src/lib/useLocalStorage.ts`

### Food and buffs

- [Food catalog](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/data/foods/index.ts): `src/data/foods/index.ts`
- [Buff definitions](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/data/buffs/index.ts): `src/data/buffs/index.ts`
- [Food and buff types](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/types/food.ts): `src/types/food.ts`

### Saved diets

- [Diet share snapshot](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/components/dietShareSnapshot.tsx): `src/components/dietShareSnapshot.tsx`
- [Diet storage](https://github.com/itsasarya/icarus-diet-planner/blob/main/src/lib/dietStorage.ts): `src/lib/dietStorage.ts`

### Other components

- **Player**
- **Browser local storage**

## Connections

- Player → Planner page: plans diets
- App routes → Main layout: wraps routes (evidence: `src/App.tsx`)
- App routes → Planner page: routes to (evidence: `src/App.tsx`)
- App routes → Saved diets page: routes to (evidence: `src/App.tsx`)
- Planner page → Planner controller: uses controller (evidence: `src/pages/home.tsx`)
- Planner page → Food search grid: renders (evidence: `src/pages/home.tsx`)
- Planner page → Player setup: renders (evidence: `src/pages/home.tsx`)
- Food search grid → Search context: reads query (evidence: `src/components/foodGrid.tsx`)
- Food search grid → Food catalog: filters catalog (evidence: `src/components/foodGrid.tsx`)
- Food search grid → Buff definitions: looks up effects (evidence: `src/components/foodGrid.tsx`)
- Food search grid → Planner controller: adds food (evidence: `src/pages/home.tsx`)
- Player setup → Selected foods: renders (evidence: `src/components/playerSetup.tsx`)
- Player setup → Buff summary: renders (evidence: `src/components/playerSetup.tsx`)
- Player setup → Planner controller: saves diet (evidence: `src/pages/home.tsx`)
- Planner controller → Local storage hook: persists selection (evidence: `src/lib/usePlannerController.ts`)
- Local storage hook → Browser local storage: reads and writes (evidence: `src/lib/useLocalStorage.ts`)
- Planner controller → Diet storage: manages presets (evidence: `src/lib/usePlannerController.ts`)
- Diet storage → Browser local storage: reads and writes (evidence: `src/lib/dietStorage.ts`)
- Saved diets page → Diet storage: loads and edits (evidence: `src/pages/savedDiets.tsx`)
- Saved diets page → Buff summary: shows details (evidence: `src/pages/savedDiets.tsx`)
- Saved diets page → Diet share snapshot: renders (evidence: `src/pages/savedDiets.tsx`)
- Planner page → Diet share codec: parses shared diet (evidence: `src/pages/home.tsx`)
- Food catalog → Food and buff types: maps records (evidence: `src/data/foods/index.ts`)
- Buff definitions → Food and buff types: uses buff types (evidence: `src/data/buffs/index.ts`)
