# atulranjan97/techmart architecture

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

- Interactive diagram: https://gitdiagram.com/atulranjan97/techmart
- Repository: https://github.com/atulranjan97/techmart

## Overview

TechMart is a MERN storefront with customer shopping, checkout and order tracking, plus administration of catalog, users and orders. The customer flow runs from browsing products through cart, shipping/payment and order placement, then payment and order status; the admin flow manages catalog, users and fulfillment. Groups represent the React experience/state, Express API, and persistent domain data. Relationships are limited to those in excerpts, the SOURCE INDEX, or README; unsampled product features are retained where documented, without guessing their internal wiring.

Main entry points: [`frontend/src/App.jsx`](https://github.com/atulranjan97/techmart/blob/main/frontend/src/App.jsx) (App shell and routes), [`backend/server.js`](https://github.com/atulranjan97/techmart/blob/main/backend/server.js) (HTTP application), [`backend/controller/orderController.js`](https://github.com/atulranjan97/techmart/blob/main/backend/controller/orderController.js) (Order lifecycle), [`backend/middleware/authMiddleware.js`](https://github.com/atulranjan97/techmart/blob/main/backend/middleware/authMiddleware.js) (JWT authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront experience"]
  node_app["App shell and routes<br/>[App.jsx]"]
  node_catalogui["Browse and review"]
  node_cartui["Cart and checkout"]
  node_orderui["Order tracking<br/>[OrderPage.jsx]"]
  node_adminui["Admin workspace"]
  node_state["Redux state and API"]
end

subgraph group_api["Commerce API"]
  node_server["HTTP application<br/>[server.js]"]
  node_productroutes["Product routes<br/>[productRoutes.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_orderroutes["Order routes<br/>[orderRoutes.js]"]
  node_upload["Image upload<br/>[uploadRoutes.js]"]
  node_productctl["Catalog and reviews"]
  node_userctl["Accounts and access<br/>[userController.js]"]
  node_orderctl["Order lifecycle<br/>[orderController.js]"]
  node_auth["JWT authorization<br/>[authMiddleware.js]"]
end

subgraph group_domain["Domain and persistence"]
  node_products[("Product records<br/>[productModel.js]")]
  node_users[("User records<br/>[userModel.js]")]
  node_orders[("Order records<br/>[orderModel.js]")]
  node_prices["Price calculation<br/>[calcPrices.js]"]
end

subgraph group_integrations["External services"]
  node_mongo[("MongoDB")]
  node_paypal["PayPal"]
end

node_shopper(("Shopper"))
node_adminuser(("Administrator"))

node_shopper -->|"uses"| node_app
node_adminuser -->|"uses"| node_app
node_app -->|"routes to"| node_catalogui
node_app -->|"routes to"| node_cartui
node_app -->|"routes to"| node_orderui
node_app -->|"routes to"| node_adminui
node_catalogui -->|"requests catalog"| node_state
node_cartui -->|"updates cart"| node_state
node_cartui -->|"submits order"| node_state
node_orderui -->|"loads order"| node_state
node_adminui -->|"requests management data"| node_state
node_server -->|"mounts"| node_productroutes
node_server -->|"mounts"| node_userroutes
node_server -->|"mounts"| node_orderroutes
node_server -->|"mounts"| node_upload
node_productroutes -->|"dispatches"| node_productctl
node_userroutes -->|"dispatches"| node_userctl
node_orderroutes -->|"dispatches"| node_orderctl
node_userroutes -->|"protects routes"| node_auth
node_productroutes -->|"protects routes"| node_auth
node_orderroutes -->|"protects routes"| node_auth
node_productctl -->|"reads and writes"| node_products
node_productctl -->|"checks purchases"| node_orders
node_userctl -->|"reads and writes"| node_users
node_userctl -->|"generates token"| node_auth
node_orderctl -->|"reads and writes"| node_orders
node_orderctl -->|"checks and updates stock"| node_products
node_orderctl -->|"calculates totals"| node_prices
node_orderctl -->|"verifies payment"| node_paypal
node_auth -->|"loads identity"| node_users
node_server -->|"connects"| node_mongo
node_products -.->|"persists"| node_mongo
node_users -.->|"persists"| node_mongo
node_orders -.->|"persists"| node_mongo

click node_app "https://github.com/atulranjan97/techmart/blob/main/frontend/src/App.jsx"
click node_catalogui "https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages"
click node_cartui "https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages"
click node_orderui "https://github.com/atulranjan97/techmart/blob/main/frontend/src/pages/OrderPage.jsx"
click node_adminui "https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages/admin"
click node_state "https://github.com/atulranjan97/techmart/tree/main/frontend/src/slices"
click node_server "https://github.com/atulranjan97/techmart/blob/main/backend/server.js"
click node_productroutes "https://github.com/atulranjan97/techmart/blob/main/backend/routes/productRoutes.js"
click node_userroutes "https://github.com/atulranjan97/techmart/blob/main/backend/routes/userRoutes.js"
click node_orderroutes "https://github.com/atulranjan97/techmart/blob/main/backend/routes/orderRoutes.js"
click node_upload "https://github.com/atulranjan97/techmart/blob/main/backend/routes/uploadRoutes.js"
click node_productctl "https://github.com/atulranjan97/techmart/blob/main/backend/controller/productController.js"
click node_userctl "https://github.com/atulranjan97/techmart/blob/main/backend/controller/userController.js"
click node_orderctl "https://github.com/atulranjan97/techmart/blob/main/backend/controller/orderController.js"
click node_auth "https://github.com/atulranjan97/techmart/blob/main/backend/middleware/authMiddleware.js"
click node_products "https://github.com/atulranjan97/techmart/blob/main/backend/models/productModel.js"
click node_users "https://github.com/atulranjan97/techmart/blob/main/backend/models/userModel.js"
click node_orders "https://github.com/atulranjan97/techmart/blob/main/backend/models/orderModel.js"
click node_prices "https://github.com/atulranjan97/techmart/blob/main/backend/utils/calcPrices.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_catalogui,node_cartui,node_orderui,node_adminui,node_state toneBlue
class node_server,node_productroutes,node_userroutes,node_orderroutes,node_upload,node_productctl,node_userctl,node_orderctl,node_auth toneAmber
class node_products,node_users,node_orders,node_prices toneMint
class node_mongo,node_paypal toneRose
class node_shopper,node_adminuser toneIndigo
```

## Components

### Storefront experience

- [App shell and routes](https://github.com/atulranjan97/techmart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Browse and review](https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages): `frontend/src/pages`
- [Cart and checkout](https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages): `frontend/src/pages`
- [Order tracking](https://github.com/atulranjan97/techmart/blob/main/frontend/src/pages/OrderPage.jsx): `frontend/src/pages/OrderPage.jsx`
- [Admin workspace](https://github.com/atulranjan97/techmart/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Redux state and API](https://github.com/atulranjan97/techmart/tree/main/frontend/src/slices): `frontend/src/slices`

### Commerce API

- [HTTP application](https://github.com/atulranjan97/techmart/blob/main/backend/server.js): `backend/server.js`
- [Product routes](https://github.com/atulranjan97/techmart/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [User routes](https://github.com/atulranjan97/techmart/blob/main/backend/routes/userRoutes.js): `backend/routes/userRoutes.js`
- [Order routes](https://github.com/atulranjan97/techmart/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Image upload](https://github.com/atulranjan97/techmart/blob/main/backend/routes/uploadRoutes.js): `backend/routes/uploadRoutes.js`
- [Catalog and reviews](https://github.com/atulranjan97/techmart/blob/main/backend/controller/productController.js): `backend/controller/productController.js`
- [Accounts and access](https://github.com/atulranjan97/techmart/blob/main/backend/controller/userController.js): `backend/controller/userController.js`
- [Order lifecycle](https://github.com/atulranjan97/techmart/blob/main/backend/controller/orderController.js): `backend/controller/orderController.js`
- [JWT authorization](https://github.com/atulranjan97/techmart/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Domain and persistence

- [Product records](https://github.com/atulranjan97/techmart/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [User records](https://github.com/atulranjan97/techmart/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Order records](https://github.com/atulranjan97/techmart/blob/main/backend/models/orderModel.js): `backend/models/orderModel.js`
- [Price calculation](https://github.com/atulranjan97/techmart/blob/main/backend/utils/calcPrices.js): `backend/utils/calcPrices.js`

### External services

- **MongoDB**
- **PayPal**

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → App shell and routes: uses
- Administrator → App shell and routes: uses
- App shell and routes → Browse and review: routes to (evidence: `frontend/src/main.jsx`)
- App shell and routes → Cart and checkout: routes to (evidence: `frontend/src/main.jsx`)
- App shell and routes → Order tracking: routes to (evidence: `frontend/src/main.jsx`)
- App shell and routes → Admin workspace: routes to (evidence: `frontend/src/main.jsx`)
- Browse and review → Redux state and API: requests catalog (evidence: `frontend/src/pages/HomePage.jsx`)
- Cart and checkout → Redux state and API: updates cart (evidence: `frontend/src/pages/CartPage.jsx`)
- Cart and checkout → Redux state and API: submits order (evidence: `frontend/src/pages/PlaceOrderPage.jsx`)
- Order tracking → Redux state and API: loads order (evidence: `frontend/src/pages/OrderPage.jsx`)
- Admin workspace → Redux state and API: requests management data (evidence: `frontend/src/pages/admin/DashboardPage.jsx`)
- HTTP application → Product routes: mounts (evidence: `backend/server.js`)
- HTTP application → User routes: mounts (evidence: `backend/server.js`)
- HTTP application → Order routes: mounts (evidence: `backend/server.js`)
- HTTP application → Image upload: mounts (evidence: `backend/server.js`)
- Product routes → Catalog and reviews: dispatches (evidence: `backend/routes/productRoutes.js`)
- User routes → Accounts and access: dispatches (evidence: `backend/routes/userRoutes.js`)
- Order routes → Order lifecycle: dispatches (evidence: `backend/routes/orderRoutes.js`)
- User routes → JWT authorization: protects routes (evidence: `backend/routes/userRoutes.js`)
- Product routes → JWT authorization: protects routes (evidence: `backend/routes/productRoutes.js`)
- Order routes → JWT authorization: protects routes (evidence: `backend/routes/orderRoutes.js`)
- Catalog and reviews → Product records: reads and writes (evidence: `backend/controller/productController.js`)
- Catalog and reviews → Order records: checks purchases (evidence: `backend/controller/productController.js`)
- Accounts and access → User records: reads and writes (evidence: `backend/controller/userController.js`)
- Accounts and access → JWT authorization: generates token (evidence: `backend/controller/userController.js`)
- Order lifecycle → Order records: reads and writes (evidence: `backend/controller/orderController.js`)
- Order lifecycle → Product records: checks and updates stock (evidence: `backend/controller/orderController.js`)
- Order lifecycle → Price calculation: calculates totals (evidence: `backend/controller/orderController.js`)
- Order lifecycle → PayPal: verifies payment (evidence: `backend/controller/orderController.js`)
- JWT authorization → User records: loads identity (evidence: `backend/middleware/authMiddleware.js`)
- HTTP application → MongoDB: connects (evidence: `backend/server.js`)
- Product records → MongoDB: persists
- User records → MongoDB: persists
- Order records → MongoDB: persists
