# redward42/datadiet architecture

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

## Overview

Data Diet is a recipe-nutrition dashboard. Users browse a Spoonacular recipe list, preview nutrition visualizations, and open a recipe’s unique detail URL for ingredients and instructions. The dashboard and detail page independently request recipe data; both reuse the sidebar and chart components. The README documents the main user features, while the sampled page code shows the API requests, rendering, and navigation. No separate backend or persistent store is shown.

Main entry points: [`src/pages/Dashboard.tsx`](https://github.com/RedWARd42/DataDiet/blob/main/src/pages/Dashboard.tsx) (Recipe dashboard), [`src/pages/DetailView.tsx`](https://github.com/RedWARd42/DataDiet/blob/main/src/pages/DetailView.tsx) (Recipe detail), [`src/routes.tsx`](https://github.com/RedWARd42/DataDiet/blob/main/src/routes.tsx) (Page routes), [`src/components/Sidebar.tsx`](https://github.com/RedWARd42/DataDiet/blob/main/src/components/Sidebar.tsx) (Navigation sidebar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App and routing"]
  node_app["App entry<br/>[App.tsx]"]
  node_routes["Page routes<br/>[routes.tsx]"]
end

subgraph group_recipes["Recipe experience"]
  node_dashboard["Recipe dashboard<br/>[Dashboard.tsx]"]
  node_detail["Recipe detail<br/>[DetailView.tsx]"]
  node_sidebar["Navigation sidebar<br/>[Sidebar.tsx]"]
end

subgraph group_visuals["Nutrition visualizations"]
  node_bar_chart["Daily recommendation chart<br/>[Barchart.tsx]"]
  node_pie_chart["Macro distribution chart<br/>[Piechart.tsx]"]
end

node_user(("User"))
node_spoonacular["Spoonacular API"]

node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_detail
node_user -->|"browses"| node_dashboard
node_dashboard -->|"fetches recipes"| node_spoonacular
node_spoonacular -->|"returns recipes"| node_dashboard
node_dashboard -->|"links to detail"| node_routes
node_dashboard -->|"renders"| node_sidebar
node_dashboard -->|"renders"| node_bar_chart
node_dashboard -->|"renders"| node_pie_chart
node_user -->|"views recipe"| node_detail
node_detail -->|"fetches details"| node_spoonacular
node_spoonacular -->|"returns recipe"| node_detail
node_detail -->|"renders"| node_sidebar
node_detail -->|"renders"| node_bar_chart
node_detail -->|"renders"| node_pie_chart

click node_app "https://github.com/RedWARd42/DataDiet/blob/main/src/App.tsx"
click node_routes "https://github.com/RedWARd42/DataDiet/blob/main/src/routes.tsx"
click node_dashboard "https://github.com/RedWARd42/DataDiet/blob/main/src/pages/Dashboard.tsx"
click node_detail "https://github.com/RedWARd42/DataDiet/blob/main/src/pages/DetailView.tsx"
click node_sidebar "https://github.com/RedWARd42/DataDiet/blob/main/src/components/Sidebar.tsx"
click node_bar_chart "https://github.com/RedWARd42/DataDiet/blob/main/src/components/Barchart.tsx"
click node_pie_chart "https://github.com/RedWARd42/DataDiet/blob/main/src/components/Piechart.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_app,node_routes,node_user toneBlue
class node_dashboard,node_detail,node_sidebar toneAmber
class node_bar_chart,node_pie_chart,node_spoonacular toneMint
```

## Components

### App and routing

- [App entry](https://github.com/RedWARd42/DataDiet/blob/main/src/App.tsx): `src/App.tsx`
- [Page routes](https://github.com/RedWARd42/DataDiet/blob/main/src/routes.tsx): `src/routes.tsx`

### Recipe experience

- [Recipe dashboard](https://github.com/RedWARd42/DataDiet/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Recipe detail](https://github.com/RedWARd42/DataDiet/blob/main/src/pages/DetailView.tsx): `src/pages/DetailView.tsx`
- [Navigation sidebar](https://github.com/RedWARd42/DataDiet/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`

### Nutrition visualizations

- [Daily recommendation chart](https://github.com/RedWARd42/DataDiet/blob/main/src/components/Barchart.tsx): `src/components/Barchart.tsx`
- [Macro distribution chart](https://github.com/RedWARd42/DataDiet/blob/main/src/components/Piechart.tsx): `src/components/Piechart.tsx`

### Other components

- **User**
- **Spoonacular API**

## Connections

- App entry → Page routes: renders (evidence: `src/App.tsx`)
- Page routes → Recipe dashboard: routes to (evidence: `src/routes.tsx`)
- Page routes → Recipe detail: routes to (evidence: `src/routes.tsx`)
- User → Recipe dashboard: browses (evidence: `README.md`)
- Recipe dashboard → Spoonacular API: fetches recipes (evidence: `src/pages/Dashboard.tsx`)
- Spoonacular API → Recipe dashboard: returns recipes (evidence: `src/pages/Dashboard.tsx`)
- Recipe dashboard → Page routes: links to detail (evidence: `src/pages/Dashboard.tsx`)
- Recipe dashboard → Navigation sidebar: renders (evidence: `src/pages/Dashboard.tsx`)
- Recipe dashboard → Daily recommendation chart: renders (evidence: `src/pages/Dashboard.tsx`)
- Recipe dashboard → Macro distribution chart: renders (evidence: `src/pages/Dashboard.tsx`)
- User → Recipe detail: views recipe (evidence: `README.md`)
- Recipe detail → Spoonacular API: fetches details (evidence: `src/pages/DetailView.tsx`)
- Spoonacular API → Recipe detail: returns recipe (evidence: `src/pages/DetailView.tsx`)
- Recipe detail → Navigation sidebar: renders (evidence: `src/pages/DetailView.tsx`)
- Recipe detail → Daily recommendation chart: renders (evidence: `src/pages/DetailView.tsx`)
- Recipe detail → Macro distribution chart: renders (evidence: `src/pages/DetailView.tsx`)
