# aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform architecture

> Architecture diagram of the GitHub repository aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform, 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/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform
- Repository: https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform

## Overview

SupplyIQ is a multi-tenant retail inventory and supply-chain dashboard. A store user signs in, then uses the frontend to access store-scoped sales, inventory, stock movements, purchase orders, imports, assistant, and forecast capabilities through the API; results are persisted in MySQL. Forecasting also has a Python ML pipeline for data preparation, feature engineering, model evaluation, and stored forecasts. The graph follows documented capabilities and source-index references; some UI-to-API wiring and unsampled subsystem internals are not directly shown, so those links are left dashed where appropriate.

Main entry points: [`backend/server.js`](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js) (Express API), [`backend/ml/ml/pipelines/forecast_pipeline.py`](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/pipelines/forecast_pipeline.py) (Forecast pipeline), [`backend/mysql.js`](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/mysql.js) (MySQL access), [`frontend/js/auth.js`](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/frontend/js/auth.js) (Client authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Store experience"]
  node_web_client["Web client<br/>[api.js]"]
  node_client_auth["Client authentication<br/>[auth.js]"]
end

subgraph group_api["API and identity"]
  node_api_server["Express API<br/>[server.js]"]
  node_identity["Auth and tenancy<br/>[auth.js]"]
end

subgraph group_operations["Inventory operations"]
  node_store_catalog["Store and catalog<br/>[catalog.js]"]
  node_sales_dashboard["Sales and KPIs<br/>[server.js]"]
  node_stock_ops["Stock ledger<br/>[stock.js]"]
  node_purchase_orders["Purchase orders<br/>[server.js]"]
  node_data_imports["Data imports<br/>[imports.js]"]
  node_assistant["TradeSaarthi assistant<br/>[server.js]"]
end

subgraph group_intelligence["Forecast intelligence"]
  node_forecast_api["Forecast API<br/>[forecast.js]"]
  node_forecast_pipeline["Forecast pipeline"]
  node_sales_features["Sales features<br/>[sales_features.py]"]
  node_inventory_features["Inventory features"]
  node_baseline_models["Baseline models<br/>[baseline.py]"]
  node_backtesting["Backtesting<br/>[backtest.py]"]
  node_forecast_metrics["Forecast metrics<br/>[metrics.py]"]
  node_synthetic_data["Synthetic sales data"]
end

subgraph group_persistence["Data persistence"]
  node_ml_data["ML data access<br/>[database.py]"]
  node_mysql_access["MySQL access<br/>[mysql.js]"]
  node_mysql_store[("MySQL store")]
end

node_store_user(("Store user"))
node_firebase{{"Firebase identity"}}

node_store_user -->|"uses"| node_web_client
node_web_client -.->|"uses"| node_client_auth
node_client_auth -.->|"requests API"| node_api_server
node_client_auth -->|"requests reset / sign-in"| node_firebase
node_api_server -->|"guards routes"| node_identity
node_api_server -->|"routes to"| node_store_catalog
node_api_server -->|"serves"| node_sales_dashboard
node_api_server -->|"routes to"| node_stock_ops
node_api_server -->|"routes to"| node_data_imports
node_api_server -->|"routes to"| node_forecast_api
node_api_server -->|"serves"| node_purchase_orders
node_api_server -->|"serves"| node_assistant
node_identity -->|"reads users"| node_mysql_access
node_stock_ops -->|"writes movements"| node_mysql_access
node_data_imports -->|"uses stock"| node_stock_ops
node_mysql_access -->|"queries"| node_mysql_store
node_forecast_api -->|"reads data"| node_mysql_access
node_forecast_pipeline -->|"loads and saves"| node_ml_data
node_forecast_pipeline -->|"generates fallback"| node_synthetic_data
node_forecast_pipeline -->|"builds features"| node_sales_features
node_forecast_pipeline -->|"builds features"| node_inventory_features
node_forecast_pipeline -->|"runs model"| node_baseline_models
node_forecast_pipeline -->|"evaluates forecasts"| node_backtesting
node_forecast_pipeline -->|"calculates metrics"| node_forecast_metrics
node_sales_features -.->|"combines features"| node_inventory_features
node_ml_data -->|"queries"| node_mysql_store
node_baseline_models -->|"scores models"| node_forecast_metrics
node_backtesting -->|"calculates metrics"| node_forecast_metrics

click node_web_client "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/frontend/js/api.js"
click node_client_auth "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/frontend/js/auth.js"
click node_api_server "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js"
click node_identity "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/auth.js"
click node_store_catalog "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/catalog.js"
click node_sales_dashboard "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js"
click node_stock_ops "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/stock.js"
click node_purchase_orders "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js"
click node_data_imports "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/imports.js"
click node_assistant "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js"
click node_forecast_api "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/forecast.js"
click node_forecast_pipeline "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/pipelines/forecast_pipeline.py"
click node_sales_features "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/features/sales_features.py"
click node_inventory_features "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/features/inventory_features.py"
click node_baseline_models "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/models/baseline.py"
click node_backtesting "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/evaluation/backtest.py"
click node_forecast_metrics "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/evaluation/metrics.py"
click node_synthetic_data "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/data/synthetic_generator.py"
click node_ml_data "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/database.py"
click node_mysql_access "https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/mysql.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_web_client,node_client_auth,node_store_user toneBlue
class node_api_server,node_identity toneAmber
class node_store_catalog,node_sales_dashboard,node_stock_ops,node_purchase_orders,node_data_imports,node_assistant toneMint
class node_forecast_api,node_forecast_pipeline,node_sales_features,node_inventory_features,node_baseline_models,node_backtesting,node_forecast_metrics,node_synthetic_data toneRose
class node_ml_data,node_mysql_access,node_mysql_store,node_firebase toneIndigo
```

## Components

### Store experience

- [Web client](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Client authentication](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/frontend/js/auth.js): `frontend/js/auth.js`

### API and identity

- [Express API](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js): `backend/server.js`
- [Auth and tenancy](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/auth.js): `backend/auth.js`

### Inventory operations

- [Store and catalog](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/catalog.js): `backend/catalog.js`
- [Sales and KPIs](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js): `backend/server.js`
- [Stock ledger](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/stock.js): `backend/stock.js`
- [Purchase orders](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js): `backend/server.js`
- [Data imports](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/imports.js): `backend/imports.js`
- [TradeSaarthi assistant](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/server.js): `backend/server.js`

### Forecast intelligence

- [Forecast API](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/forecast.js): `backend/forecast.js`
- [Forecast pipeline](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/pipelines/forecast_pipeline.py): `backend/ml/ml/pipelines/forecast_pipeline.py`
- [Sales features](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/features/sales_features.py): `backend/ml/ml/features/sales_features.py`
- [Inventory features](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/features/inventory_features.py): `backend/ml/ml/features/inventory_features.py`
- [Baseline models](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/models/baseline.py): `backend/ml/ml/models/baseline.py`
- [Backtesting](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/evaluation/backtest.py): `backend/ml/ml/evaluation/backtest.py`
- [Forecast metrics](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/evaluation/metrics.py): `backend/ml/ml/evaluation/metrics.py`
- [Synthetic sales data](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/data/synthetic_generator.py): `backend/ml/ml/data/synthetic_generator.py`

### Data persistence

- [ML data access](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/ml/ml/database.py): `backend/ml/ml/database.py`
- [MySQL access](https://github.com/aksp42/supplyiq-ai-powered-inventory-supply-chain-intelligence-platform/blob/main/backend/mysql.js): `backend/mysql.js`
- **MySQL store**

### Other components

- **Store user**
- **Firebase identity**

## Connections

- Store user → Web client: uses (evidence: `README.md`)
- Web client → Client authentication: uses
- Client authentication → Express API: requests API
- Client authentication → Firebase identity: requests reset / sign-in (evidence: `README.md`)
- Express API → Auth and tenancy: guards routes (evidence: `backend/server.js`)
- Express API → Store and catalog: routes to (evidence: `backend/server.js`)
- Express API → Sales and KPIs: serves (evidence: `backend/server.js`)
- Express API → Stock ledger: routes to (evidence: `backend/server.js`)
- Express API → Data imports: routes to (evidence: `backend/server.js`)
- Express API → Forecast API: routes to (evidence: `backend/server.js`)
- Express API → Purchase orders: serves (evidence: `README.md`)
- Express API → TradeSaarthi assistant: serves (evidence: `README.md`)
- Auth and tenancy → MySQL access: reads users (evidence: `backend/auth.js`)
- Stock ledger → MySQL access: writes movements (evidence: `backend/stock.js`)
- Data imports → Stock ledger: uses stock (evidence: `backend/imports.js`)
- MySQL access → MySQL store: queries (evidence: `backend/mysql.js`)
- Forecast API → MySQL access: reads data (evidence: `backend/forecast.js`)
- Forecast pipeline → ML data access: loads and saves (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Synthetic sales data: generates fallback (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Sales features: builds features (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Inventory features: builds features (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Baseline models: runs model (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Backtesting: evaluates forecasts (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Forecast pipeline → Forecast metrics: calculates metrics (evidence: `backend/ml/ml/pipelines/forecast_pipeline.py`)
- Sales features → Inventory features: combines features (evidence: `backend/ml/ml/features/inventory_features.py`)
- ML data access → MySQL store: queries (evidence: `backend/ml/ml/database.py`)
- Baseline models → Forecast metrics: scores models (evidence: `backend/ml/ml/models/baseline.py`)
- Backtesting → Forecast metrics: calculates metrics (evidence: `backend/ml/ml/evaluation/backtest.py`)
