# supuzz/amazon-inventory-modelling architecture

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

- Interactive diagram: https://gitdiagram.com/supuzz/amazon-inventory-modelling
- Repository: https://github.com/supuzz/amazon-inventory-modelling

## Overview

FBA Manager is a browser-based inventory and replenishment simulator. Users configure a simulation, model sales and replenishment batches, then inspect inventory and timing visualizations or generate an AI replenishment plan; simulations can be saved and restored. `js/main.js` coordinates the UI and updates shared state, while domain modules calculate sales and stock or render views. The supplied excerpts show the Express static server and module interactions, but not `index.html`, so the browser entry wiring is not represented.

Main entry points: [`js/main.js`](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/main.js) (App coordinator), [`js/inventory.js`](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/inventory.js) (Inventory chart), [`js/sales.js`](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/sales.js) (Sales curves), [`js/i18n.js`](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/i18n.js) (Localization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Web delivery"]
  node_server["Static server<br/>[server.js]"]
  node_page["App page<br/>[index.html]"]
end

subgraph group_workflow["Simulation workflow"]
  node_main["App coordinator<br/>[main.js]"]
  node_sales["Sales curves<br/>[sales.js]"]
  node_ai["AI replenishment"]
  node_history["Simulation history<br/>[history.js]"]
end

subgraph group_views["Planning views"]
  node_gantt["Batch timeline<br/>[gantt.js]"]
  node_inventory["Inventory chart<br/>[inventory.js]"]
  node_previews["Sales previews<br/>[sales.js]"]
  node_plan["Plan export view<br/>[main.js]"]
end

subgraph group_support["State and support"]
  node_state["Simulation state<br/>[state.js]"]
  node_i18n["Localization<br/>[i18n.js]"]
  node_utils["Date and curve helpers<br/>[utils.js]"]
end

node_user(("User"))
node_browserstore[("Browser local storage")]
node_chartjs["Chart.js"]

node_user -->|"requests page"| node_server
node_server -->|"serves"| node_page
node_main -->|"uses"| node_state
node_main -->|"draws previews"| node_sales
node_main -->|"updates timeline"| node_gantt
node_main -->|"updates chart"| node_inventory
node_main -->|"manages records"| node_history
node_main -->|"uses translations"| node_i18n
node_main -->|"requests plan"| node_ai
node_main -->|"renders plan"| node_plan
node_ai -->|"gets sales curve"| node_sales
node_inventory -->|"gets sales curve"| node_sales
node_inventory -->|"formats dates"| node_utils
node_gantt -->|"formats dates"| node_utils
node_gantt -->|"gets translations"| node_i18n
node_inventory -->|"gets translations"| node_i18n
node_sales -->|"uses curve helper"| node_utils
node_history -->|"reads and writes"| node_browserstore
node_i18n -->|"reads and writes"| node_browserstore
node_inventory -->|"renders chart"| node_chartjs

click node_server "https://github.com/supuzz/amazon-inventory-modelling/blob/master/server.js"
click node_page "https://github.com/supuzz/amazon-inventory-modelling/blob/master/index.html"
click node_main "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/main.js"
click node_state "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/state.js"
click node_sales "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/sales.js"
click node_ai "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/ai_replenishment.js"
click node_gantt "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/gantt.js"
click node_inventory "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/inventory.js"
click node_previews "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/sales.js"
click node_history "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/history.js"
click node_plan "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/main.js"
click node_i18n "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/i18n.js"
click node_utils "https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/utils.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_server,node_page,node_user toneBlue
class node_main,node_sales,node_ai,node_history,node_browserstore toneAmber
class node_gantt,node_inventory,node_previews,node_plan toneMint
class node_state,node_i18n,node_utils toneRose
class node_chartjs toneIndigo
```

## Components

### Web delivery

- [Static server](https://github.com/supuzz/amazon-inventory-modelling/blob/master/server.js): `server.js`
- [App page](https://github.com/supuzz/amazon-inventory-modelling/blob/master/index.html): `index.html`

### Simulation workflow

- [App coordinator](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/main.js): `js/main.js`
- [Sales curves](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/sales.js): `js/sales.js`
- [AI replenishment](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/ai_replenishment.js): `js/ai_replenishment.js`
- [Simulation history](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/history.js): `js/history.js`

### Planning views

- [Batch timeline](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/gantt.js): `js/gantt.js`
- [Inventory chart](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/inventory.js): `js/inventory.js`
- [Sales previews](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/sales.js): `js/sales.js`
- [Plan export view](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/main.js): `js/main.js`

### State and support

- [Simulation state](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/state.js): `js/state.js`
- [Localization](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/i18n.js): `js/i18n.js`
- [Date and curve helpers](https://github.com/supuzz/amazon-inventory-modelling/blob/master/js/utils.js): `js/utils.js`

### Other components

- **User**
- **Browser local storage**
- **Chart.js**

## Connections

- User → Static server: requests page (evidence: `server.js`)
- Static server → App page: serves (evidence: `server.js`)
- App coordinator → Simulation state: uses (evidence: `js/main.js`)
- App coordinator → Sales curves: draws previews (evidence: `js/main.js`)
- App coordinator → Batch timeline: updates timeline (evidence: `js/main.js`)
- App coordinator → Inventory chart: updates chart (evidence: `js/main.js`)
- App coordinator → Simulation history: manages records (evidence: `js/main.js`)
- App coordinator → Localization: uses translations (evidence: `js/main.js`)
- App coordinator → AI replenishment: requests plan (evidence: `js/main.js`)
- App coordinator → Plan export view: renders plan (evidence: `js/main.js`)
- AI replenishment → Sales curves: gets sales curve (evidence: `js/ai_replenishment.js`)
- Inventory chart → Sales curves: gets sales curve (evidence: `js/inventory.js`)
- Inventory chart → Date and curve helpers: formats dates (evidence: `js/inventory.js`)
- Batch timeline → Date and curve helpers: formats dates (evidence: `js/gantt.js`)
- Batch timeline → Localization: gets translations (evidence: `js/gantt.js`)
- Inventory chart → Localization: gets translations (evidence: `js/inventory.js`)
- Sales curves → Date and curve helpers: uses curve helper (evidence: `js/sales.js`)
- Simulation history → Browser local storage: reads and writes (evidence: `js/history.js`)
- Localization → Browser local storage: reads and writes (evidence: `js/i18n.js`)
- Inventory chart → Chart.js: renders chart (evidence: `js/inventory.js`)
