# puneethkumar-tech/smart-inventory-supply-chain architecture

> Architecture diagram of the GitHub repository puneethkumar-tech/smart-inventory-supply-chain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/puneethkumar-tech/smart-inventory-supply-chain
- Repository: https://github.com/puneethkumar-tech/smart-inventory-supply-chain

## Overview

Smart Inventory is a React and Express application for managing products, suppliers, purchase orders, and operational insights. The main workflow runs from the web interface through a domain service and REST API to PostgreSQL, then returns data for display; completing an order also updates product stock. The README documents dashboard analytics, demand forecasting, CSV reports, and settings as additional capabilities. Some frontend-to-service and model-to-database wiring is inferred from the documented architecture and tree; sampled excerpts do not cover every subsystem.

Main entry points: [`frontend/src/App.jsx`](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/App.jsx) (App and routes), [`backend/server.js`](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/server.js) (Express server), [`frontend/src/services/api.js`](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/api.js) (API client), [`backend/config/db.js`](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/config/db.js) (Database connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["App and routes<br/>[App.jsx]"]
  node_dashboard_ui["Dashboard page<br/>[Dashboard.jsx]"]
  node_inventory_ui["Inventory page<br/>[Inventory.jsx]"]
  node_suppliers_ui["Suppliers page<br/>[Suppliers.jsx]"]
  node_orders_ui["Orders page<br/>[Orders.jsx]"]
  node_forecast_ui["Forecast page<br/>[Forecast.jsx]"]
  node_reports_ui["Reports page<br/>[Reports.jsx]"]
  node_settings_ui["Settings page<br/>[Settings.jsx]"]
  node_inventory_service["Inventory service"]
  node_supplier_service["Supplier service<br/>[supplierService.js]"]
  node_order_service["Order service<br/>[orderService.js]"]
  node_dashboard_service["Dashboard service"]
  node_report_service["Report service<br/>[reportService.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_server["Express server<br/>[server.js]"]
  node_product_routes["Product routes<br/>[productRoutes.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_supplier_routes["Supplier routes<br/>[supplierRoutes.js]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_report_routes["Report routes<br/>[reportRoutes.js]"]
  node_db_config["Database connection<br/>[db.js]"]
end

subgraph group_domain["Inventory domains"]
  node_product_controller["Product controller"]
  node_order_controller["Order controller<br/>[orderController.js]"]
  node_supplier_controller["Supplier controller"]
  node_product_model["Product model<br/>[productModel.js]"]
  node_order_model["Order model<br/>[orderModel.js]"]
  node_supplier_model["Supplier model<br/>[supplierModel.js]"]
end

subgraph group_insights["Analytics and reports"]
  node_dashboard_controller["Dashboard controller"]
  node_dashboard_model["Dashboard model<br/>[dashboardModel.js]"]
  node_report_controller["Report controller"]
  node_report_model["Report model<br/>[reportModel.js]"]
end

node_operator(("Operator"))
node_postgres[("PostgreSQL")]

node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard_ui
node_app -->|"routes to"| node_inventory_ui
node_app -->|"routes to"| node_suppliers_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_forecast_ui
node_app -->|"routes to"| node_reports_ui
node_app -->|"routes to"| node_settings_ui
node_inventory_ui -->|"requests data"| node_inventory_service
node_suppliers_ui -->|"requests data"| node_supplier_service
node_orders_ui -->|"requests data"| node_order_service
node_dashboard_ui -->|"requests data"| node_dashboard_service
node_forecast_ui -->|"requests forecast"| node_dashboard_service
node_reports_ui -->|"requests reports"| node_report_service
node_inventory_service -->|"calls"| node_api_client
node_supplier_service -->|"calls"| node_api_client
node_order_service -->|"calls"| node_api_client
node_dashboard_service -->|"calls"| node_api_client
node_report_service -->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_order_routes
node_server -->|"mounts"| node_supplier_routes
node_server -->|"mounts"| node_dashboard_routes
node_server -->|"mounts"| node_report_routes
node_product_routes -->|"dispatches"| node_product_controller
node_order_routes -->|"dispatches"| node_order_controller
node_supplier_routes -->|"dispatches"| node_supplier_controller
node_dashboard_routes -->|"dispatches"| node_dashboard_controller
node_report_routes -->|"dispatches"| node_report_controller
node_product_controller -->|"reads and writes"| node_product_model
node_order_controller -->|"reads and writes"| node_order_model
node_order_controller -->|"adjusts stock"| node_product_model
node_supplier_controller -->|"reads and writes"| node_supplier_model
node_product_controller -->|"logs activity"| node_dashboard_model
node_order_controller -->|"logs activity"| node_dashboard_model
node_supplier_controller -->|"logs activity"| node_dashboard_model
node_dashboard_controller -->|"queries analytics"| node_dashboard_model
node_report_controller -->|"queries and records"| node_report_model
node_report_controller -->|"logs activity"| node_dashboard_model
node_product_model -->|"queries"| node_db_config
node_order_model -->|"queries"| node_db_config
node_supplier_model -->|"queries"| node_db_config
node_dashboard_model -->|"queries"| node_db_config
node_report_model -->|"queries"| node_db_config
node_db_config -->|"connects"| node_postgres

click node_app "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/App.jsx"
click node_dashboard_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Dashboard.jsx"
click node_inventory_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Inventory.jsx"
click node_suppliers_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Suppliers.jsx"
click node_orders_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Orders.jsx"
click node_forecast_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Forecast.jsx"
click node_reports_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Reports.jsx"
click node_settings_ui "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Settings.jsx"
click node_inventory_service "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/inventoryService.js"
click node_supplier_service "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/supplierService.js"
click node_order_service "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/orderService.js"
click node_dashboard_service "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/dashboardService.js"
click node_report_service "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/reportService.js"
click node_api_client "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/server.js"
click node_product_routes "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/productRoutes.js"
click node_order_routes "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/orderRoutes.js"
click node_supplier_routes "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/supplierRoutes.js"
click node_dashboard_routes "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/dashboardRoutes.js"
click node_report_routes "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/reportRoutes.js"
click node_product_controller "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/productController.js"
click node_order_controller "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/orderController.js"
click node_supplier_controller "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/supplierController.js"
click node_product_model "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/productModel.js"
click node_order_model "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/orderModel.js"
click node_supplier_model "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/supplierModel.js"
click node_dashboard_controller "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/dashboardController.js"
click node_dashboard_model "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/dashboardModel.js"
click node_report_controller "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/reportController.js"
click node_report_model "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/reportModel.js"
click node_db_config "https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/config/db.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_dashboard_ui,node_inventory_ui,node_suppliers_ui,node_orders_ui,node_forecast_ui,node_reports_ui,node_settings_ui,node_inventory_service,node_supplier_service,node_order_service,node_dashboard_service,node_report_service,node_api_client toneBlue
class node_server,node_product_routes,node_order_routes,node_supplier_routes,node_dashboard_routes,node_report_routes,node_db_config,node_postgres toneAmber
class node_product_controller,node_order_controller,node_supplier_controller,node_product_model,node_order_model,node_supplier_model toneMint
class node_dashboard_controller,node_dashboard_model,node_report_controller,node_report_model toneRose
class node_operator toneIndigo
```

## Components

### Web interface

- [App and routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Inventory page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Inventory.jsx): `frontend/src/pages/Inventory.jsx`
- [Suppliers page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Suppliers.jsx): `frontend/src/pages/Suppliers.jsx`
- [Orders page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [Forecast page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Forecast.jsx): `frontend/src/pages/Forecast.jsx`
- [Reports page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [Settings page](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/pages/Settings.jsx): `frontend/src/pages/Settings.jsx`
- [Inventory service](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/inventoryService.js): `frontend/src/services/inventoryService.js`
- [Supplier service](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/supplierService.js): `frontend/src/services/supplierService.js`
- [Order service](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/orderService.js): `frontend/src/services/orderService.js`
- [Dashboard service](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/dashboardService.js): `frontend/src/services/dashboardService.js`
- [Report service](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/reportService.js): `frontend/src/services/reportService.js`
- [API client](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### REST API

- [Express server](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/server.js): `backend/server.js`
- [Product routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Order routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Supplier routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/supplierRoutes.js): `backend/routes/supplierRoutes.js`
- [Dashboard routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/dashboardRoutes.js): `backend/routes/dashboardRoutes.js`
- [Report routes](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/routes/reportRoutes.js): `backend/routes/reportRoutes.js`
- [Database connection](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/config/db.js): `backend/config/db.js`

### Inventory domains

- [Product controller](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Order controller](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Supplier controller](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/supplierController.js): `backend/controllers/supplierController.js`
- [Product model](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [Order model](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/orderModel.js): `backend/models/orderModel.js`
- [Supplier model](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/supplierModel.js): `backend/models/supplierModel.js`

### Analytics and reports

- [Dashboard controller](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/dashboardController.js): `backend/controllers/dashboardController.js`
- [Dashboard model](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/dashboardModel.js): `backend/models/dashboardModel.js`
- [Report controller](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/controllers/reportController.js): `backend/controllers/reportController.js`
- [Report model](https://github.com/puneethkumar-tech/smart-inventory-supply-chain/blob/main/backend/models/reportModel.js): `backend/models/reportModel.js`

### Other components

- **Operator**
- **PostgreSQL**

## Connections

- Operator → App and routes: uses
- App and routes → Dashboard page: routes to
- App and routes → Inventory page: routes to
- App and routes → Suppliers page: routes to
- App and routes → Orders page: routes to
- App and routes → Forecast page: routes to
- App and routes → Reports page: routes to
- App and routes → Settings page: routes to
- Inventory page → Inventory service: requests data
- Suppliers page → Supplier service: requests data
- Orders page → Order service: requests data
- Dashboard page → Dashboard service: requests data
- Forecast page → Dashboard service: requests forecast
- Reports page → Report service: requests reports
- Inventory service → API client: calls
- Supplier service → API client: calls
- Order service → API client: calls
- Dashboard service → API client: calls
- Report service → API client: calls
- API client → Express server: HTTP requests
- Express server → Product routes: mounts
- Express server → Order routes: mounts
- Express server → Supplier routes: mounts
- Express server → Dashboard routes: mounts
- Express server → Report routes: mounts
- Product routes → Product controller: dispatches
- Order routes → Order controller: dispatches
- Supplier routes → Supplier controller: dispatches
- Dashboard routes → Dashboard controller: dispatches
- Report routes → Report controller: dispatches
- Product controller → Product model: reads and writes
- Order controller → Order model: reads and writes
- Order controller → Product model: adjusts stock
- Supplier controller → Supplier model: reads and writes
- Product controller → Dashboard model: logs activity
- Order controller → Dashboard model: logs activity
- Supplier controller → Dashboard model: logs activity
- Dashboard controller → Dashboard model: queries analytics
- Report controller → Report model: queries and records
- Report controller → Dashboard model: logs activity
- Product model → Database connection: queries
- Order model → Database connection: queries
- Supplier model → Database connection: queries
- Dashboard model → Database connection: queries
- Report model → Database connection: queries
- Database connection → PostgreSQL: connects
