# hasttyr/nutriflow architecture

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

- Interactive diagram: https://gitdiagram.com/hasttyr/nutriflow
- Repository: https://github.com/hasttyr/nutriflow

## Overview

nutriFlow is a grocery-planning and shopping app: shoppers locate nearby stores, browse local products, plan meals and lists, compare branch prices, then check out and follow orders. Its distributed behavior can run as a simulated browser cluster or connect to a multi-process backend. The graph preserves documented planning, sharing, regional, account, merchant/courier and system-status capabilities. Several page and server internals were not sampled; their documented roles are shown, but uncertain implementation links are omitted. Evidence uses README statements or the cited source excerpts and index references.

Main entry points: [`src/App.jsx`](https://github.com/hasttyr/nutriflow/blob/main/src/App.jsx) (Route application), [`src/geo/region.js`](https://github.com/hasttyr/nutriflow/blob/main/src/geo/region.js) (Region and stores), [`src/planner/planner.js`](https://github.com/hasttyr/nutriflow/blob/main/src/planner/planner.js) (Meal planner), [`src/pages/Checkout.jsx`](https://github.com/hasttyr/nutriflow/blob/main/src/pages/Checkout.jsx) (Checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_journey["Shopping journey"]
  node_app["Route application<br/>[App.jsx]"]
  node_catalog["Local product catalog<br/>[products.js]"]
  node_planner["Meal planner<br/>[planner.js]"]
  node_ai["Meal-plan AI endpoint<br/>[ai.js]"]
  node_list["Shopping list<br/>[list.js]"]
  node_sharing["Link and QR sharing<br/>[share.js]"]
  node_cart["Cart state<br/>[cart.js]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_payment["Payment step<br/>[PaymentStep.jsx]"]
end

subgraph group_region["Regional experience"]
  node_location["Location detection<br/>[location.js]"]
  node_regional["Region and stores<br/>[region.js]"]
  node_storedata["Nearby store lookup<br/>[stores.js]"]
  node_profiles["Country profiles<br/>[profiles.js]"]
  node_money["Money and quotes<br/>[money.js]"]
  node_pricing["Country prices<br/>[pricing.js]"]
end

subgraph group_runtime["Distributed runtime"]
  node_cluster["Branch cluster<br/>[cluster.js]"]
  node_clusterhooks["Cluster state hooks<br/>[hooks.js]"]
  node_inventory["Branch inventory<br/>[inventory.js]"]
  node_session["Demo session<br/>[session.js]"]
  node_live["Shared live state<br/>[store.js]"]
  node_systemstatus["Cluster status console<br/>[SystemStatus.jsx]"]
end

subgraph group_operations["Order operations"]
  node_orders["Order coordination<br/>[orders.js]"]
  node_livebackend["Live region service<br/>[region.js]"]
  node_serverpayments["Payment service<br/>[payments.js]"]
  node_logistics["Delivery logistics<br/>[logistics.js]"]
  node_notifications["Order notifications<br/>[notifications.js]"]
end

subgraph group_interface["Interface foundations"]
  node_locale["Language and messages<br/>[i18n.js]"]
  node_ui["Shared UI controls<br/>[Field.jsx]"]
end

node_shopper(("Shopper"))
node_planneruser(("Planner user"))
node_openstreetmap["OpenStreetMap"]
node_pollinations["Pollinations AI"]
node_merchant(("Merchant operator"))
node_courier(("Courier"))

node_shopper -->|"uses"| node_app
node_app -->|"checks region"| node_regional
node_regional -->|"locates shopper"| node_location
node_regional -->|"finds nearby stores"| node_storedata
node_storedata -->|"queries places"| node_openstreetmap
node_regional -->|"sets branch nodes"| node_cluster
node_regional -->|"selects profile"| node_profiles
node_shopper -->|"browses products"| node_catalog
node_catalog -->|"uses local prices"| node_pricing
node_pricing -->|"formats amounts"| node_money
node_planneruser -->|"requests a plan"| node_app
node_planner -->|"selects products"| node_catalog
node_planner -->|"compares stores"| node_inventory
node_planner -.->|"requests menu"| node_pollinations
node_planner -->|"adds plan items"| node_list
node_shopper -->|"manages list"| node_list
node_list -->|"moves missing items"| node_cart
node_shopper -->|"shares plan or list"| node_sharing
node_shopper -->|"checks out"| node_checkout
node_checkout -->|"quotes branches"| node_inventory
node_checkout -->|"starts payment step"| node_payment
node_checkout -->|"creates confirmed order"| node_orders
node_orders -->|"updates shared state"| node_live
node_orders -->|"routes branch work"| node_cluster
node_app -->|"reads role"| node_session
node_app -->|"follows regions"| node_live
node_systemstatus -->|"shows node health"| node_clusterhooks
node_merchant -->|"uses merchant view"| node_app
node_courier -->|"uses courier view"| node_app
node_orders -.->|"connects live orders"| node_livebackend
node_livebackend -.->|"dispatches payments"| node_serverpayments
node_livebackend -.->|"dispatches delivery"| node_logistics
node_livebackend -.->|"dispatches notices"| node_notifications

click node_app "https://github.com/hasttyr/nutriflow/blob/main/src/App.jsx"
click node_location "https://github.com/hasttyr/nutriflow/blob/main/src/geo/location.js"
click node_regional "https://github.com/hasttyr/nutriflow/blob/main/src/geo/region.js"
click node_storedata "https://github.com/hasttyr/nutriflow/blob/main/src/geo/stores.js"
click node_profiles "https://github.com/hasttyr/nutriflow/blob/main/src/region/profiles.js"
click node_money "https://github.com/hasttyr/nutriflow/blob/main/src/region/money.js"
click node_pricing "https://github.com/hasttyr/nutriflow/blob/main/src/region/pricing.js"
click node_catalog "https://github.com/hasttyr/nutriflow/blob/main/src/data/products.js"
click node_cluster "https://github.com/hasttyr/nutriflow/blob/main/src/distributed/cluster.js"
click node_clusterhooks "https://github.com/hasttyr/nutriflow/blob/main/src/distributed/hooks.js"
click node_inventory "https://github.com/hasttyr/nutriflow/blob/main/src/distributed/inventory.js"
click node_planner "https://github.com/hasttyr/nutriflow/blob/main/src/planner/planner.js"
click node_ai "https://github.com/hasttyr/nutriflow/blob/main/api/ai.js"
click node_list "https://github.com/hasttyr/nutriflow/blob/main/src/list/list.js"
click node_sharing "https://github.com/hasttyr/nutriflow/blob/main/src/share/share.js"
click node_cart "https://github.com/hasttyr/nutriflow/blob/main/src/cart/cart.js"
click node_checkout "https://github.com/hasttyr/nutriflow/blob/main/src/pages/Checkout.jsx"
click node_payment "https://github.com/hasttyr/nutriflow/blob/main/src/payments/PaymentStep.jsx"
click node_orders "https://github.com/hasttyr/nutriflow/blob/main/src/live/orders.js"
click node_livebackend "https://github.com/hasttyr/nutriflow/blob/main/server/region.js"
click node_serverpayments "https://github.com/hasttyr/nutriflow/blob/main/server/payments.js"
click node_logistics "https://github.com/hasttyr/nutriflow/blob/main/server/logistics.js"
click node_notifications "https://github.com/hasttyr/nutriflow/blob/main/server/notifications.js"
click node_session "https://github.com/hasttyr/nutriflow/blob/main/src/live/session.js"
click node_live "https://github.com/hasttyr/nutriflow/blob/main/src/live/store.js"
click node_locale "https://github.com/hasttyr/nutriflow/blob/main/src/i18n/i18n.js"
click node_ui "https://github.com/hasttyr/nutriflow/blob/main/src/ui/Field.jsx"
click node_systemstatus "https://github.com/hasttyr/nutriflow/blob/main/src/pages/SystemStatus.jsx"

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_catalog,node_planner,node_ai,node_list,node_sharing,node_cart,node_checkout,node_payment,node_planneruser toneBlue
class node_location,node_regional,node_storedata,node_profiles,node_money,node_pricing toneAmber
class node_cluster,node_clusterhooks,node_inventory,node_session,node_live,node_systemstatus toneMint
class node_orders,node_livebackend,node_serverpayments,node_logistics,node_notifications toneRose
class node_locale,node_ui,node_shopper,node_openstreetmap,node_pollinations,node_merchant,node_courier toneIndigo
```

## Components

### Shopping journey

- [Route application](https://github.com/hasttyr/nutriflow/blob/main/src/App.jsx): `src/App.jsx`
- [Local product catalog](https://github.com/hasttyr/nutriflow/blob/main/src/data/products.js): `src/data/products.js`
- [Meal planner](https://github.com/hasttyr/nutriflow/blob/main/src/planner/planner.js): `src/planner/planner.js`
- [Meal-plan AI endpoint](https://github.com/hasttyr/nutriflow/blob/main/api/ai.js): `api/ai.js`
- [Shopping list](https://github.com/hasttyr/nutriflow/blob/main/src/list/list.js): `src/list/list.js`
- [Link and QR sharing](https://github.com/hasttyr/nutriflow/blob/main/src/share/share.js): `src/share/share.js`
- [Cart state](https://github.com/hasttyr/nutriflow/blob/main/src/cart/cart.js): `src/cart/cart.js`
- [Checkout](https://github.com/hasttyr/nutriflow/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Payment step](https://github.com/hasttyr/nutriflow/blob/main/src/payments/PaymentStep.jsx): `src/payments/PaymentStep.jsx`

### Regional experience

- [Location detection](https://github.com/hasttyr/nutriflow/blob/main/src/geo/location.js): `src/geo/location.js`
- [Region and stores](https://github.com/hasttyr/nutriflow/blob/main/src/geo/region.js): `src/geo/region.js`
- [Nearby store lookup](https://github.com/hasttyr/nutriflow/blob/main/src/geo/stores.js): `src/geo/stores.js`
- [Country profiles](https://github.com/hasttyr/nutriflow/blob/main/src/region/profiles.js): `src/region/profiles.js`
- [Money and quotes](https://github.com/hasttyr/nutriflow/blob/main/src/region/money.js): `src/region/money.js`
- [Country prices](https://github.com/hasttyr/nutriflow/blob/main/src/region/pricing.js): `src/region/pricing.js`

### Distributed runtime

- [Branch cluster](https://github.com/hasttyr/nutriflow/blob/main/src/distributed/cluster.js): `src/distributed/cluster.js`
- [Cluster state hooks](https://github.com/hasttyr/nutriflow/blob/main/src/distributed/hooks.js): `src/distributed/hooks.js`
- [Branch inventory](https://github.com/hasttyr/nutriflow/blob/main/src/distributed/inventory.js): `src/distributed/inventory.js`
- [Demo session](https://github.com/hasttyr/nutriflow/blob/main/src/live/session.js): `src/live/session.js`
- [Shared live state](https://github.com/hasttyr/nutriflow/blob/main/src/live/store.js): `src/live/store.js`
- [Cluster status console](https://github.com/hasttyr/nutriflow/blob/main/src/pages/SystemStatus.jsx): `src/pages/SystemStatus.jsx`

### Order operations

- [Order coordination](https://github.com/hasttyr/nutriflow/blob/main/src/live/orders.js): `src/live/orders.js`
- [Live region service](https://github.com/hasttyr/nutriflow/blob/main/server/region.js): `server/region.js`
- [Payment service](https://github.com/hasttyr/nutriflow/blob/main/server/payments.js): `server/payments.js`
- [Delivery logistics](https://github.com/hasttyr/nutriflow/blob/main/server/logistics.js): `server/logistics.js`
- [Order notifications](https://github.com/hasttyr/nutriflow/blob/main/server/notifications.js): `server/notifications.js`

### Interface foundations

- [Language and messages](https://github.com/hasttyr/nutriflow/blob/main/src/i18n/i18n.js): `src/i18n/i18n.js`
- [Shared UI controls](https://github.com/hasttyr/nutriflow/blob/main/src/ui/Field.jsx): `src/ui/Field.jsx`

### Other components

- **Shopper**
- **Planner user**
- **OpenStreetMap**
- **Pollinations AI**
- **Merchant operator**
- **Courier**

## Connections

- Shopper → Route application: uses
- Route application → Region and stores: checks region (evidence: `src/App.jsx`)
- Region and stores → Location detection: locates shopper (evidence: `src/geo/region.js`)
- Region and stores → Nearby store lookup: finds nearby stores (evidence: `src/geo/region.js`)
- Nearby store lookup → OpenStreetMap: queries places
- Region and stores → Branch cluster: sets branch nodes (evidence: `src/geo/region.js`)
- Region and stores → Country profiles: selects profile (evidence: `src/geo/region.js`)
- Shopper → Local product catalog: browses products
- Local product catalog → Country prices: uses local prices
- Country prices → Money and quotes: formats amounts (evidence: `src/region/pricing.js`)
- Planner user → Route application: requests a plan
- Meal planner → Local product catalog: selects products (evidence: `src/planner/planner.js`)
- Meal planner → Branch inventory: compares stores (evidence: `src/planner/planner.js`)
- Meal planner → Pollinations AI: requests menu
- Meal planner → Shopping list: adds plan items
- Shopper → Shopping list: manages list
- Shopping list → Cart state: moves missing items
- Shopper → Link and QR sharing: shares plan or list
- Shopper → Checkout: checks out
- Checkout → Branch inventory: quotes branches (evidence: `src/pages/Checkout.jsx`)
- Checkout → Payment step: starts payment step (evidence: `src/pages/Checkout.jsx`)
- Checkout → Order coordination: creates confirmed order (evidence: `src/pages/Checkout.jsx`)
- Order coordination → Shared live state: updates shared state (evidence: `src/live/orders.js`)
- Order coordination → Branch cluster: routes branch work (evidence: `src/live/orders.js`)
- Route application → Demo session: reads role (evidence: `src/main.jsx`)
- Route application → Shared live state: follows regions (evidence: `src/main.jsx`)
- Cluster status console → Cluster state hooks: shows node health
- Merchant operator → Route application: uses merchant view
- Courier → Route application: uses courier view
- Order coordination → Live region service: connects live orders
- Live region service → Payment service: dispatches payments
- Live region service → Delivery logistics: dispatches delivery
- Live region service → Order notifications: dispatches notices
