# chandan-0416/novamart architecture

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

- Interactive diagram: https://gitdiagram.com/chandan-0416/novamart
- Repository: https://github.com/chandan-0416/novamart

## Overview

NovaMart is a full-stack e-commerce marketplace: shoppers browse a catalog, authenticate, manage a cart, check out, and review orders; admins manage products and fulfillment. The React SPA uses Redux slices and API clients to communicate with an Express REST API, whose controllers delegate to business services backed by PostgreSQL. The README also documents atomic inventory checkout and an MCP operational server. Some feature-level links rely on README documentation because their source files were not sampled; those limits are reflected in the graph.

Main entry points: [`backend/src/config/db.js`](https://github.com/chandan-0416/novamart/blob/main/backend/src/config/db.js) (Database Pool), [`frontend/src/store/store.js`](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/store.js) (Redux Store), [`frontend/src/App.jsx`](https://github.com/chandan-0416/novamart/blob/main/frontend/src/App.jsx) (React App Router), [`frontend/src/store/slices/productSlice.js`](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/productSlice.js) (Product State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront"]
  node_app["React App Router<br/>[App.jsx]"]
  node_catalog_ui["Catalog Pages<br/>[HomePage.jsx]"]
  node_admin_ui["Admin Console"]
  node_redux["Redux Store<br/>[store.js]"]
  node_auth_state["Auth State<br/>[authSlice.js]"]
  node_product_state["Product State<br/>[productSlice.js]"]
  node_cart_state["Cart State<br/>[cartSlice.js]"]
  node_order_state["Order State<br/>[orderSlice.js]"]
  node_api_client["Axios API Client<br/>[axiosClient.js]"]
end

subgraph group_http["API Layer"]
  node_api["Express REST API<br/>[app.js]"]
  node_auth_routes["Auth Routes<br/>[auth.routes.js]"]
  node_product_routes["Product Routes<br/>[product.routes.js]"]
  node_cart_routes["Cart Routes<br/>[cart.routes.js]"]
  node_order_routes["Order Routes<br/>[order.routes.js]"]
  node_auth_controller["Auth Handlers<br/>[auth.controller.js]"]
  node_product_controller["Product Handlers"]
  node_cart_controller["Cart Handlers<br/>[cart.controller.js]"]
  node_order_controller["Order Handlers"]
end

subgraph group_domain["Commerce Services"]
  node_auth_service["Authentication<br/>[auth.service.js]"]
  node_product_service["Catalog Management<br/>[product.service.js]"]
  node_cart_service["Cart Operations<br/>[cart.service.js]"]
  node_order_service["Checkout and Orders<br/>[order.service.js]"]
end

subgraph group_platform["Data and Operations"]
  node_postgres[("PostgreSQL")]
  node_db_access["Database Pool<br/>[db.js]"]
  node_mcp["MCP Operations Tools"]
end

node_shopper(("Shopper / Admin"))

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_admin_ui
node_app -->|"fetches cart"| node_cart_state
node_redux -->|"registers"| node_auth_state
node_redux -->|"registers"| node_product_state
node_redux -->|"registers"| node_cart_state
node_redux -->|"registers"| node_order_state
node_auth_state -->|"calls auth API"| node_api_client
node_product_state -->|"calls product API"| node_api_client
node_catalog_ui -->|"loads catalog"| node_product_state
node_admin_ui -->|"manages products"| node_product_state
node_admin_ui -->|"manages fulfillment"| node_order_state
node_api_client -->|"sends REST requests"| node_api
node_api -->|"mounts routes"| node_auth_routes
node_api -->|"mounts routes"| node_product_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_product_routes -->|"dispatches"| node_product_controller
node_cart_routes -->|"dispatches"| node_cart_controller
node_order_routes -->|"dispatches"| node_order_controller
node_auth_controller -->|"delegates"| node_auth_service
node_product_controller -->|"delegates"| node_product_service
node_cart_controller -->|"delegates"| node_cart_service
node_order_controller -->|"delegates"| node_order_service
node_auth_service -->|"queries"| node_db_access
node_product_service -->|"queries"| node_db_access
node_cart_service -->|"queries"| node_db_access
node_order_service -->|"uses transactions"| node_db_access
node_db_access -->|"queries"| node_postgres
node_order_service -->|"locks inventory rows"| node_postgres
node_shopper -.->|"operates"| node_mcp
node_mcp -.->|"runs reporting tools"| node_postgres

click node_app "https://github.com/chandan-0416/novamart/blob/main/frontend/src/App.jsx"
click node_catalog_ui "https://github.com/chandan-0416/novamart/blob/main/frontend/src/pages/HomePage.jsx"
click node_admin_ui "https://github.com/chandan-0416/novamart/blob/main/frontend/src/pages/AdminDashboardPage.jsx"
click node_redux "https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/store.js"
click node_auth_state "https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/authSlice.js"
click node_product_state "https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/productSlice.js"
click node_cart_state "https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/cartSlice.js"
click node_order_state "https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/orderSlice.js"
click node_api_client "https://github.com/chandan-0416/novamart/blob/main/frontend/src/api/axiosClient.js"
click node_api "https://github.com/chandan-0416/novamart/blob/main/backend/src/app.js"
click node_auth_routes "https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/auth.routes.js"
click node_product_routes "https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/product.routes.js"
click node_cart_routes "https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/cart.routes.js"
click node_order_routes "https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/order.routes.js"
click node_auth_controller "https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/auth.controller.js"
click node_product_controller "https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/product.controller.js"
click node_cart_controller "https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/cart.controller.js"
click node_order_controller "https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/order.controller.js"
click node_auth_service "https://github.com/chandan-0416/novamart/blob/main/backend/src/services/auth.service.js"
click node_product_service "https://github.com/chandan-0416/novamart/blob/main/backend/src/services/product.service.js"
click node_cart_service "https://github.com/chandan-0416/novamart/blob/main/backend/src/services/cart.service.js"
click node_order_service "https://github.com/chandan-0416/novamart/blob/main/backend/src/services/order.service.js"
click node_db_access "https://github.com/chandan-0416/novamart/blob/main/backend/src/config/db.js"
click node_mcp "https://github.com/chandan-0416/novamart/blob/main/backend/src/mcp/novamartMcpServer.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_catalog_ui,node_admin_ui,node_redux,node_auth_state,node_product_state,node_cart_state,node_order_state,node_api_client toneBlue
class node_api,node_auth_routes,node_product_routes,node_cart_routes,node_order_routes,node_auth_controller,node_product_controller,node_cart_controller,node_order_controller toneAmber
class node_auth_service,node_product_service,node_cart_service,node_order_service toneMint
class node_postgres,node_db_access,node_mcp toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [React App Router](https://github.com/chandan-0416/novamart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Catalog Pages](https://github.com/chandan-0416/novamart/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Admin Console](https://github.com/chandan-0416/novamart/blob/main/frontend/src/pages/AdminDashboardPage.jsx): `frontend/src/pages/AdminDashboardPage.jsx`
- [Redux Store](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/store.js): `frontend/src/store/store.js`
- [Auth State](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/authSlice.js): `frontend/src/store/slices/authSlice.js`
- [Product State](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/productSlice.js): `frontend/src/store/slices/productSlice.js`
- [Cart State](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/cartSlice.js): `frontend/src/store/slices/cartSlice.js`
- [Order State](https://github.com/chandan-0416/novamart/blob/main/frontend/src/store/slices/orderSlice.js): `frontend/src/store/slices/orderSlice.js`
- [Axios API Client](https://github.com/chandan-0416/novamart/blob/main/frontend/src/api/axiosClient.js): `frontend/src/api/axiosClient.js`

### API Layer

- [Express REST API](https://github.com/chandan-0416/novamart/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth Routes](https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Product Routes](https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/product.routes.js): `backend/src/routes/product.routes.js`
- [Cart Routes](https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/cart.routes.js): `backend/src/routes/cart.routes.js`
- [Order Routes](https://github.com/chandan-0416/novamart/blob/main/backend/src/routes/order.routes.js): `backend/src/routes/order.routes.js`
- [Auth Handlers](https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Product Handlers](https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/product.controller.js): `backend/src/controllers/product.controller.js`
- [Cart Handlers](https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/cart.controller.js): `backend/src/controllers/cart.controller.js`
- [Order Handlers](https://github.com/chandan-0416/novamart/blob/main/backend/src/controllers/order.controller.js): `backend/src/controllers/order.controller.js`

### Commerce Services

- [Authentication](https://github.com/chandan-0416/novamart/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`
- [Catalog Management](https://github.com/chandan-0416/novamart/blob/main/backend/src/services/product.service.js): `backend/src/services/product.service.js`
- [Cart Operations](https://github.com/chandan-0416/novamart/blob/main/backend/src/services/cart.service.js): `backend/src/services/cart.service.js`
- [Checkout and Orders](https://github.com/chandan-0416/novamart/blob/main/backend/src/services/order.service.js): `backend/src/services/order.service.js`

### Data and Operations

- **PostgreSQL**
- [Database Pool](https://github.com/chandan-0416/novamart/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [MCP Operations Tools](https://github.com/chandan-0416/novamart/blob/main/backend/src/mcp/novamartMcpServer.js): `backend/src/mcp/novamartMcpServer.js`

### Other components

- **Shopper / Admin**

## Connections

- Shopper / Admin → React App Router: uses
- React App Router → Catalog Pages: routes to (evidence: `frontend/src/App.jsx`)
- React App Router → Admin Console: routes to (evidence: `frontend/src/App.jsx`)
- React App Router → Cart State: fetches cart (evidence: `frontend/src/App.jsx`)
- Redux Store → Auth State: registers (evidence: `frontend/src/store/store.js`)
- Redux Store → Product State: registers (evidence: `frontend/src/store/store.js`)
- Redux Store → Cart State: registers (evidence: `frontend/src/store/store.js`)
- Redux Store → Order State: registers (evidence: `frontend/src/store/store.js`)
- Auth State → Axios API Client: calls auth API (evidence: `frontend/src/store/slices/authSlice.js`)
- Product State → Axios API Client: calls product API (evidence: `frontend/src/store/slices/productSlice.js`)
- Catalog Pages → Product State: loads catalog (evidence: `frontend/src/pages/HomePage.jsx`)
- Admin Console → Product State: manages products (evidence: `frontend/src/pages/AdminDashboardPage.jsx`)
- Admin Console → Order State: manages fulfillment (evidence: `frontend/src/pages/AdminDashboardPage.jsx`)
- Axios API Client → Express REST API: sends REST requests
- Express REST API → Auth Routes: mounts routes (evidence: `backend/src/app.js`)
- Express REST API → Product Routes: mounts routes (evidence: `backend/src/app.js`)
- Auth Routes → Auth Handlers: dispatches (evidence: `backend/src/routes/auth.routes.js`)
- Product Routes → Product Handlers: dispatches (evidence: `backend/src/routes/product.routes.js`)
- Cart Routes → Cart Handlers: dispatches (evidence: `backend/src/routes/cart.routes.js`)
- Order Routes → Order Handlers: dispatches (evidence: `backend/src/routes/order.routes.js`)
- Auth Handlers → Authentication: delegates (evidence: `backend/src/controllers/auth.controller.js`)
- Product Handlers → Catalog Management: delegates (evidence: `backend/src/controllers/product.controller.js`)
- Cart Handlers → Cart Operations: delegates (evidence: `backend/src/controllers/cart.controller.js`)
- Order Handlers → Checkout and Orders: delegates (evidence: `backend/src/controllers/order.controller.js`)
- Authentication → Database Pool: queries (evidence: `backend/src/services/auth.service.js`)
- Catalog Management → Database Pool: queries (evidence: `backend/src/services/product.service.js`)
- Cart Operations → Database Pool: queries (evidence: `backend/src/services/cart.service.js`)
- Checkout and Orders → Database Pool: uses transactions (evidence: `backend/src/services/order.service.js`)
- Database Pool → PostgreSQL: queries (evidence: `backend/src/config/db.js`)
- Checkout and Orders → PostgreSQL: locks inventory rows
- Shopper / Admin → MCP Operations Tools: operates
- MCP Operations Tools → PostgreSQL: runs reporting tools
