# wwwoper/food-flow architecture

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

- Interactive diagram: https://gitdiagram.com/wwwoper/food-flow
- Repository: https://github.com/wwwoper/food-flow

## Overview

food-flow is a personal menu web app, delivered as a browser-based PWA. The main workflow loads menu metadata and the day index, builds navigation and day sections, lazily fetches a selected day, and renders meal cards; user actions then update portions, cooking marks, pins, and statistics in device-local storage. The README also documents offline use through a service worker. The sampled JavaScript supports the runtime call paths; content and offline relationships are additionally documented in the README. Content-authoring and validation tools are excluded as maintenance tooling.

Main entry points: [`shared/js/app.js`](https://github.com/wwwoper/food-flow/blob/main/shared/js/app.js) (App and navigation), [`shared/js/store.js`](https://github.com/wwwoper/food-flow/blob/main/shared/js/store.js) (JSON loader), [`shared/js/shell.js`](https://github.com/wwwoper/food-flow/blob/main/shared/js/shell.js) (Page shell), [`shared/js/state.js`](https://github.com/wwwoper/food-flow/blob/main/shared/js/state.js) (Personal state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser app"]
  node_app["App and navigation<br/>[app.js]"]
  node_shell["Page shell<br/>[shell.js]"]
  node_renderer["Meal renderer<br/>[render.js]"]
  node_loader["JSON loader<br/>[store.js]"]
end

subgraph group_menu["Menu content"]
  node_metadata["Menu metadata<br/>[meta.json]"]
  node_index["Day index<br/>[days.json]"]
  node_days["Day data"]
end

subgraph group_personal["Personal features"]
  node_features["Menu features<br/>[features.js]"]
  node_state[("Personal state<br/>[state.js]")]
end

subgraph group_offline["Offline PWA"]
  node_worker["Offline worker<br/>[service-worker.js]"]
  node_browsercache[("Browser cache")]
end

node_user(("Menu user"))

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_shell
node_shell -->|"loads metadata"| node_loader
node_shell -->|"reads options"| node_state
node_app -->|"loads days"| node_loader
node_app -->|"renders meals"| node_renderer
node_app -->|"initializes features"| node_features
node_app -->|"reads pin"| node_state
node_loader -->|"fetches JSON"| node_metadata
node_loader -->|"fetches JSON"| node_index
node_loader -->|"fetches JSON"| node_days
node_features -->|"reads and writes"| node_state
node_app -->|"registers"| node_worker
node_worker -->|"caches offline assets"| node_browsercache
node_browsercache -.->|"serves offline"| node_days

click node_app "https://github.com/wwwoper/food-flow/blob/main/shared/js/app.js"
click node_shell "https://github.com/wwwoper/food-flow/blob/main/shared/js/shell.js"
click node_renderer "https://github.com/wwwoper/food-flow/blob/main/shared/js/render.js"
click node_loader "https://github.com/wwwoper/food-flow/blob/main/shared/js/store.js"
click node_metadata "https://github.com/wwwoper/food-flow/blob/main/content/meta.json"
click node_index "https://github.com/wwwoper/food-flow/blob/main/content/days.json"
click node_days "https://github.com/wwwoper/food-flow/tree/main/content/days"
click node_features "https://github.com/wwwoper/food-flow/blob/main/shared/js/features.js"
click node_state "https://github.com/wwwoper/food-flow/blob/main/shared/js/state.js"
click node_worker "https://github.com/wwwoper/food-flow/blob/main/service-worker.js"

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_shell,node_renderer,node_loader,node_user toneBlue
class node_metadata,node_index,node_days toneAmber
class node_features,node_state toneMint
class node_worker,node_browsercache toneRose
```

## Components

### Browser app

- [App and navigation](https://github.com/wwwoper/food-flow/blob/main/shared/js/app.js): `shared/js/app.js`
- [Page shell](https://github.com/wwwoper/food-flow/blob/main/shared/js/shell.js): `shared/js/shell.js`
- [Meal renderer](https://github.com/wwwoper/food-flow/blob/main/shared/js/render.js): `shared/js/render.js`
- [JSON loader](https://github.com/wwwoper/food-flow/blob/main/shared/js/store.js): `shared/js/store.js`

### Menu content

- [Menu metadata](https://github.com/wwwoper/food-flow/blob/main/content/meta.json): `content/meta.json`
- [Day index](https://github.com/wwwoper/food-flow/blob/main/content/days.json): `content/days.json`
- [Day data](https://github.com/wwwoper/food-flow/tree/main/content/days): `content/days`

### Personal features

- [Menu features](https://github.com/wwwoper/food-flow/blob/main/shared/js/features.js): `shared/js/features.js`
- [Personal state](https://github.com/wwwoper/food-flow/blob/main/shared/js/state.js): `shared/js/state.js`

### Offline PWA

- [Offline worker](https://github.com/wwwoper/food-flow/blob/main/service-worker.js): `service-worker.js`
- **Browser cache**

### Other components

- **Menu user**

## Connections

- Menu user → App and navigation: uses (evidence: `README.md`)
- App and navigation → Page shell: initializes (evidence: `shared/js/app.js`)
- Page shell → JSON loader: loads metadata (evidence: `shared/js/shell.js`)
- Page shell → Personal state: reads options (evidence: `shared/js/shell.js`)
- App and navigation → JSON loader: loads days (evidence: `shared/js/app.js`)
- App and navigation → Meal renderer: renders meals (evidence: `shared/js/app.js`)
- App and navigation → Menu features: initializes features (evidence: `shared/js/app.js`)
- App and navigation → Personal state: reads pin (evidence: `shared/js/app.js`)
- JSON loader → Menu metadata: fetches JSON (evidence: `shared/js/store.js`)
- JSON loader → Day index: fetches JSON (evidence: `shared/js/store.js`)
- JSON loader → Day data: fetches JSON (evidence: `shared/js/store.js`)
- Menu features → Personal state: reads and writes (evidence: `shared/js/features.js`)
- App and navigation → Offline worker: registers (evidence: `shared/js/app.js`)
- Offline worker → Browser cache: caches offline assets (evidence: `README.md`)
- Browser cache → Day data: serves offline (evidence: `README.md`)
