# abhii-navv/order-management architecture

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

- Interactive diagram: https://gitdiagram.com/abhii-navv/order-management
- Repository: https://github.com/abhii-navv/order-management

## Overview

This is a React and Express inventory/order-management application. Users authenticate, browse products, build a cart, and place orders; administrators manage products and categories, stock, and reports. The frontend routes screens through a shared Axios client to the versioned API. Backend routes apply authentication and role checks before controllers perform domain operations against PostgreSQL. Orders include stock updates and audit logging, and the order controller generates PDF invoices. The graph preserves documented reporting and audit capabilities; some frontend pages and backend modules were not sampled, so their internal links are omitted where unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/abhii-navv/order-management/blob/main/frontend/src/App.jsx) (App routes), [`frontend/src/api.js`](https://github.com/abhii-navv/order-management/blob/main/frontend/src/api.js) (API client), [`backend/server.js`](https://github.com/abhii-navv/order-management/blob/main/backend/server.js) (Express API), [`backend/src/controllers/orderController.js`](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/orderController.js) (Order and invoices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["App routes<br/>[App.jsx]"]
  node_login["Login and registration<br/>[Login.jsx]"]
  node_products_ui["Product catalog<br/>[Products.jsx]"]
  node_cart["Cart state<br/>[CartContext.jsx]"]
  node_cart_ui["Cart and checkout<br/>[Cart.jsx]"]
  node_categories_ui["Category management<br/>[Categories.jsx]"]
  node_orders_ui["Orders<br/>[Orders.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_reports_ui["Reports<br/>[Reports.jsx]"]
  node_audit_ui["Audit logs<br/>[AuditLogs.jsx]"]
end

subgraph group_api["API and access"]
  node_api_client["API client<br/>[api.js]"]
  node_server["Express API<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_auth_guard["JWT and role guards<br/>[auth.js]"]
end

subgraph group_operations["Inventory operations"]
  node_product_controller["Product operations"]
  node_category_controller["Category operations"]
  node_order_controller["Order and invoices<br/>[orderController.js]"]
  node_product_model["Product data access<br/>[Product.js]"]
  node_audit_model["Stock audit log<br/>[StockAuditLog.js]"]
end

subgraph group_insights["Reporting and persistence"]
  node_report_controller["Analytics and reports"]
  node_postgres[("PostgreSQL")]
end

node_shopper(("User or admin"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_products_ui
node_app -->|"routes to"| node_categories_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_cart_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_reports_ui
node_app -->|"routes to"| node_audit_ui
node_products_ui -->|"requests data"| node_api_client
node_cart_ui -->|"places order"| node_api_client
node_cart_ui -->|"reads cart"| node_cart
node_products_ui -->|"adds items"| node_cart
node_categories_ui -->|"requests data"| node_api_client
node_orders_ui -->|"requests data"| node_api_client
node_dashboard -->|"requests data"| node_api_client
node_reports_ui -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_server
node_server -->|"mounts routes"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"checks access"| node_auth_guard
node_server -.->|"mounts routes"| node_product_controller
node_server -.->|"mounts routes"| node_category_controller
node_server -.->|"mounts routes"| node_order_controller
node_server -.->|"mounts routes"| node_report_controller
node_product_controller -->|"calls"| node_product_model
node_product_controller -->|"writes and reads"| node_audit_model
node_order_controller -->|"checks stock"| node_product_model
node_order_controller -->|"writes audit"| node_audit_model
node_report_controller -->|"queries low stock"| node_product_model
node_report_controller -->|"queries logs"| node_audit_model
node_product_model -->|"reads and writes"| node_postgres
node_audit_model -->|"reads and writes"| node_postgres
node_auth_controller -.->|"persists account data"| node_postgres
node_report_controller -->|"queries analytics"| node_postgres
node_category_controller -.->|"persists categories"| node_postgres
node_order_controller -->|"transactions and order data"| node_postgres

click node_app "https://github.com/abhii-navv/order-management/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Login.jsx"
click node_products_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Products.jsx"
click node_cart "https://github.com/abhii-navv/order-management/blob/main/frontend/src/context/CartContext.jsx"
click node_cart_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Cart.jsx"
click node_categories_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Categories.jsx"
click node_orders_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Orders.jsx"
click node_dashboard "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Dashboard.jsx"
click node_reports_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Reports.jsx"
click node_audit_ui "https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/AuditLogs.jsx"
click node_api_client "https://github.com/abhii-navv/order-management/blob/main/frontend/src/api.js"
click node_server "https://github.com/abhii-navv/order-management/blob/main/backend/server.js"
click node_auth_routes "https://github.com/abhii-navv/order-management/blob/main/backend/src/routes/authRoutes.js"
click node_auth_controller "https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/authController.js"
click node_auth_guard "https://github.com/abhii-navv/order-management/blob/main/backend/src/middleware/auth.js"
click node_product_controller "https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/productController.js"
click node_category_controller "https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/categoryController.js"
click node_order_controller "https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/orderController.js"
click node_product_model "https://github.com/abhii-navv/order-management/blob/main/backend/src/models/Product.js"
click node_audit_model "https://github.com/abhii-navv/order-management/blob/main/backend/src/models/StockAuditLog.js"
click node_report_controller "https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/reportController.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_login,node_products_ui,node_cart,node_cart_ui,node_categories_ui,node_orders_ui,node_dashboard,node_reports_ui,node_audit_ui,node_shopper toneBlue
class node_api_client,node_server,node_auth_routes,node_auth_controller,node_auth_guard toneAmber
class node_product_controller,node_category_controller,node_order_controller,node_product_model,node_audit_model toneMint
class node_report_controller,node_postgres toneRose
```

## Components

### React application

- [App routes](https://github.com/abhii-navv/order-management/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and registration](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Product catalog](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Products.jsx): `frontend/src/pages/Products.jsx`
- [Cart state](https://github.com/abhii-navv/order-management/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [Cart and checkout](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Cart.jsx): `frontend/src/pages/Cart.jsx`
- [Category management](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Categories.jsx): `frontend/src/pages/Categories.jsx`
- [Orders](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [Dashboard](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Reports](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [Audit logs](https://github.com/abhii-navv/order-management/blob/main/frontend/src/pages/AuditLogs.jsx): `frontend/src/pages/AuditLogs.jsx`

### API and access

- [API client](https://github.com/abhii-navv/order-management/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Express API](https://github.com/abhii-navv/order-management/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/abhii-navv/order-management/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`
- [Authentication](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [JWT and role guards](https://github.com/abhii-navv/order-management/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`

### Inventory operations

- [Product operations](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/productController.js): `backend/src/controllers/productController.js`
- [Category operations](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/categoryController.js): `backend/src/controllers/categoryController.js`
- [Order and invoices](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/orderController.js): `backend/src/controllers/orderController.js`
- [Product data access](https://github.com/abhii-navv/order-management/blob/main/backend/src/models/Product.js): `backend/src/models/Product.js`
- [Stock audit log](https://github.com/abhii-navv/order-management/blob/main/backend/src/models/StockAuditLog.js): `backend/src/models/StockAuditLog.js`

### Reporting and persistence

- [Analytics and reports](https://github.com/abhii-navv/order-management/blob/main/backend/src/controllers/reportController.js): `backend/src/controllers/reportController.js`
- **PostgreSQL**

### Other components

- **User or admin**

## Connections

- User or admin → App routes: uses (evidence: `frontend/src/App.jsx`)
- App routes → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Product catalog: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Category management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Orders: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Cart and checkout: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Reports: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Audit logs: routes to (evidence: `frontend/src/App.jsx`)
- Product catalog → API client: requests data (evidence: `frontend/src/pages/Products.jsx`)
- Cart and checkout → API client: places order (evidence: `frontend/src/pages/Cart.jsx`)
- Cart and checkout → Cart state: reads cart (evidence: `frontend/src/pages/Cart.jsx`)
- Product catalog → Cart state: adds items (evidence: `frontend/src/pages/Products.jsx`)
- Category management → API client: requests data (evidence: `frontend/src/pages/Categories.jsx`)
- Orders → API client: requests data (evidence: `frontend/src/pages/Orders.jsx`)
- Dashboard → API client: requests data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Reports → API client: requests data (evidence: `frontend/src/pages/Reports.jsx`)
- API client → Express API: calls API (evidence: `README.md`)
- Express API → Auth routes: mounts routes (evidence: `backend/server.js`)
- Auth routes → Authentication: dispatches (evidence: `backend/src/routes/authRoutes.js`)
- Auth routes → JWT and role guards: checks access (evidence: `backend/src/routes/authRoutes.js`)
- Express API → Product operations: mounts routes
- Express API → Category operations: mounts routes
- Express API → Order and invoices: mounts routes
- Express API → Analytics and reports: mounts routes
- Product operations → Product data access: calls (evidence: `backend/src/controllers/productController.js`)
- Product operations → Stock audit log: writes and reads (evidence: `backend/src/controllers/productController.js`)
- Order and invoices → Product data access: checks stock (evidence: `backend/src/controllers/orderController.js`)
- Order and invoices → Stock audit log: writes audit (evidence: `backend/src/controllers/orderController.js`)
- Analytics and reports → Product data access: queries low stock (evidence: `backend/src/controllers/reportController.js`)
- Analytics and reports → Stock audit log: queries logs (evidence: `backend/src/controllers/reportController.js`)
- Product data access → PostgreSQL: reads and writes (evidence: `backend/src/models/Product.js`)
- Stock audit log → PostgreSQL: reads and writes (evidence: `backend/src/models/StockAuditLog.js`)
- Authentication → PostgreSQL: persists account data
- Analytics and reports → PostgreSQL: queries analytics (evidence: `backend/src/controllers/reportController.js`)
- Category operations → PostgreSQL: persists categories
- Order and invoices → PostgreSQL: transactions and order data (evidence: `backend/src/controllers/orderController.js`)
