# mellvvin/shopzone architecture

> Architecture diagram of the GitHub repository mellvvin/shopzone, 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/mellvvin/shopzone
- Repository: https://github.com/mellvvin/shopzone

## Overview

ShopZone is an e-commerce marketplace with buyer, seller, and admin workflows. Buyers discover products, manage a cart, place and pay for orders, then track delivery; bulk or heavy orders support seller and admin delivery quotes before buyer approval. Sellers apply and manage listings and orders, while admins review sellers, products, enquiries, orders, and payouts. The graph includes the React entry and routing, API routing and domain handlers, and Mongo-backed domain records. Some frontend pages and backend subsystems are indexed but unsampled, so their internal calls are not inferred.

Main entry points: [`backend/server.js`](https://github.com/mellvvin/shopzone/blob/main/backend/server.js) (API server), [`frontend/src/App.jsx`](https://github.com/mellvvin/shopzone/blob/main/frontend/src/App.jsx) (React app), [`backend/controllers/orderController.js`](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/orderController.js) (Order and delivery handlers), [`backend/controllers/paymentController.js`](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/paymentController.js) (Payment handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront and account"]
  node_app["React app<br/>[App.jsx]"]
  node_auth_ui["Login and profile<br/>[LoginPage.jsx]"]
  node_catalog_ui["Catalog browsing<br/>[ProductPage.jsx]"]
  node_client_state["Client state<br/>[authSlice.js]"]
end

subgraph group_commerce["Commerce and fulfillment"]
  node_cart_ui["Cart and checkout<br/>[PlaceOrderPage.jsx]"]
  node_orders_ui["Order tracking<br/>[OrderPage.jsx]"]
  node_payment_ui["Payment flow<br/>[PaymentPage.jsx]"]
  node_order_api["Order and delivery handlers<br/>[orderController.js]"]
  node_payment_api["Payment handlers"]
end

subgraph group_marketplace["Seller and administration"]
  node_seller_ui["Seller dashboard"]
  node_admin_ui["Admin workflows"]
  node_enquiry_ui["Bulk enquiries<br/>[BulkOrdersPage.jsx]"]
  node_seller_api["Seller handlers"]
  node_enquiry_api["Enquiry handlers"]
end

subgraph group_platform["API and persistence"]
  node_api_server["API server<br/>[server.js]"]
  node_auth["Access control<br/>[authMiddleware.js]"]
  node_user_api["User handlers<br/>[userController.js]"]
  node_product_api["Product handlers"]
  node_notification_api["Notification handlers"]
  node_user_store[("User records<br/>[User.js]")]
  node_product_store[("Product records<br/>[Product.js]")]
  node_order_store[("Order records<br/>[Order.js]")]
  node_payment_store[("Payment records<br/>[Payment.js]")]
  node_enquiry_store[("Enquiry records<br/>[Enquiry.js]")]
  node_notification_store[("Notification records<br/>[Notification.js]")]
end

node_buyer(("Buyer"))
node_seller_actor(("Seller"))
node_admin_actor(("Admin"))

node_buyer -->|"uses"| node_app
node_seller_actor -->|"uses"| node_app
node_admin_actor -->|"uses"| node_app
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_cart_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_payment_ui
node_app -->|"routes to"| node_seller_ui
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_enquiry_ui
node_auth_ui -->|"updates"| node_client_state
node_catalog_ui -.->|"uses"| node_client_state
node_cart_ui -.->|"continues to"| node_orders_ui
node_cart_ui -.->|"submits via API"| node_api_server
node_payment_ui -.->|"submits via API"| node_api_server
node_seller_ui -.->|"submits via API"| node_api_server
node_admin_ui -.->|"submits via API"| node_api_server
node_enquiry_ui -.->|"submits via API"| node_api_server
node_api_server -->|"mounts routes"| node_user_api
node_api_server -->|"mounts routes"| node_product_api
node_api_server -->|"mounts routes"| node_order_api
node_api_server -->|"mounts routes"| node_payment_api
node_api_server -->|"mounts routes"| node_seller_api
node_api_server -->|"mounts routes"| node_enquiry_api
node_api_server -->|"mounts routes"| node_notification_api
node_order_api -->|"routes protect"| node_auth
node_user_api -->|"reads and writes"| node_user_store
node_product_api -->|"reads and writes"| node_product_store
node_product_api -->|"checks seller"| node_user_store
node_product_api -->|"checks purchase"| node_order_store
node_order_api -->|"reads and writes"| node_order_store
node_order_api -->|"checks and updates stock"| node_product_store
node_order_api -->|"creates alerts"| node_notification_store
node_payment_api -->|"uses"| node_payment_store
node_payment_api -->|"updates orders"| node_order_store
node_payment_api -->|"creates alerts"| node_notification_store
node_seller_api -->|"manages listings"| node_product_store
node_seller_api -->|"manages fulfillment"| node_order_store
node_seller_api -->|"checks seller"| node_user_store
node_enquiry_api -->|"reads and writes"| node_enquiry_store
node_enquiry_api -->|"uses"| node_user_store

click node_app "https://github.com/mellvvin/shopzone/blob/main/frontend/src/App.jsx"
click node_auth_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/LoginPage.jsx"
click node_catalog_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/ProductPage.jsx"
click node_cart_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/PlaceOrderPage.jsx"
click node_orders_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/OrderPage.jsx"
click node_payment_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/PaymentPage.jsx"
click node_seller_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/SellerDashboardPage.jsx"
click node_admin_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/AdminOrderListPage.jsx"
click node_enquiry_ui "https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/BulkOrdersPage.jsx"
click node_client_state "https://github.com/mellvvin/shopzone/blob/main/frontend/src/redux/slices/authSlice.js"
click node_api_server "https://github.com/mellvvin/shopzone/blob/main/backend/server.js"
click node_auth "https://github.com/mellvvin/shopzone/blob/main/backend/middleware/authMiddleware.js"
click node_user_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/userController.js"
click node_product_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/productController.js"
click node_order_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/orderController.js"
click node_payment_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/paymentController.js"
click node_seller_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/sellerController.js"
click node_enquiry_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/enquiryController.js"
click node_notification_api "https://github.com/mellvvin/shopzone/blob/main/backend/controllers/notificationController.js"
click node_user_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/User.js"
click node_product_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/Product.js"
click node_order_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/Order.js"
click node_payment_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/Payment.js"
click node_enquiry_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/Enquiry.js"
click node_notification_store "https://github.com/mellvvin/shopzone/blob/main/backend/models/Notification.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_auth_ui,node_catalog_ui,node_client_state toneBlue
class node_cart_ui,node_orders_ui,node_payment_ui,node_order_api,node_payment_api toneAmber
class node_seller_ui,node_admin_ui,node_enquiry_ui,node_seller_api,node_enquiry_api toneMint
class node_api_server,node_auth,node_user_api,node_product_api,node_notification_api,node_user_store,node_product_store,node_order_store,node_payment_store,node_enquiry_store,node_notification_store toneRose
class node_buyer,node_seller_actor,node_admin_actor toneIndigo
```

## Components

### Storefront and account

- [React app](https://github.com/mellvvin/shopzone/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and profile](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Catalog browsing](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/ProductPage.jsx): `frontend/src/pages/ProductPage.jsx`
- [Client state](https://github.com/mellvvin/shopzone/blob/main/frontend/src/redux/slices/authSlice.js): `frontend/src/redux/slices/authSlice.js`

### Commerce and fulfillment

- [Cart and checkout](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/PlaceOrderPage.jsx): `frontend/src/pages/PlaceOrderPage.jsx`
- [Order tracking](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/OrderPage.jsx): `frontend/src/pages/OrderPage.jsx`
- [Payment flow](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/PaymentPage.jsx): `frontend/src/pages/PaymentPage.jsx`
- [Order and delivery handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Payment handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/paymentController.js): `backend/controllers/paymentController.js`

### Seller and administration

- [Seller dashboard](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/SellerDashboardPage.jsx): `frontend/src/pages/SellerDashboardPage.jsx`
- [Admin workflows](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/AdminOrderListPage.jsx): `frontend/src/pages/AdminOrderListPage.jsx`
- [Bulk enquiries](https://github.com/mellvvin/shopzone/blob/main/frontend/src/pages/BulkOrdersPage.jsx): `frontend/src/pages/BulkOrdersPage.jsx`
- [Seller handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/sellerController.js): `backend/controllers/sellerController.js`
- [Enquiry handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/enquiryController.js): `backend/controllers/enquiryController.js`

### API and persistence

- [API server](https://github.com/mellvvin/shopzone/blob/main/backend/server.js): `backend/server.js`
- [Access control](https://github.com/mellvvin/shopzone/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [User handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Product handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Notification handlers](https://github.com/mellvvin/shopzone/blob/main/backend/controllers/notificationController.js): `backend/controllers/notificationController.js`
- [User records](https://github.com/mellvvin/shopzone/blob/main/backend/models/User.js): `backend/models/User.js`
- [Product records](https://github.com/mellvvin/shopzone/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Order records](https://github.com/mellvvin/shopzone/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Payment records](https://github.com/mellvvin/shopzone/blob/main/backend/models/Payment.js): `backend/models/Payment.js`
- [Enquiry records](https://github.com/mellvvin/shopzone/blob/main/backend/models/Enquiry.js): `backend/models/Enquiry.js`
- [Notification records](https://github.com/mellvvin/shopzone/blob/main/backend/models/Notification.js): `backend/models/Notification.js`

### Other components

- **Buyer**
- **Seller**
- **Admin**

## Connections

- Buyer → React app: uses
- Seller → React app: uses
- Admin → React app: uses
- React app → Login and profile: routes to (evidence: `frontend/src/App.jsx`)
- React app → Catalog browsing: routes to (evidence: `frontend/src/App.jsx`)
- React app → Cart and checkout: routes to (evidence: `frontend/src/App.jsx`)
- React app → Order tracking: routes to (evidence: `frontend/src/App.jsx`)
- React app → Payment flow: routes to (evidence: `frontend/src/App.jsx`)
- React app → Seller dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React app → Admin workflows: routes to (evidence: `frontend/src/App.jsx`)
- React app → Bulk enquiries: routes to (evidence: `frontend/src/App.jsx`)
- Login and profile → Client state: updates
- Catalog browsing → Client state: uses
- Cart and checkout → Order tracking: continues to
- Cart and checkout → API server: submits via API
- Payment flow → API server: submits via API
- Seller dashboard → API server: submits via API
- Admin workflows → API server: submits via API
- Bulk enquiries → API server: submits via API
- API server → User handlers: mounts routes (evidence: `backend/server.js`)
- API server → Product handlers: mounts routes (evidence: `backend/server.js`)
- API server → Order and delivery handlers: mounts routes (evidence: `backend/server.js`)
- API server → Payment handlers: mounts routes (evidence: `backend/server.js`)
- API server → Seller handlers: mounts routes (evidence: `backend/server.js`)
- API server → Enquiry handlers: mounts routes (evidence: `backend/server.js`)
- API server → Notification handlers: mounts routes (evidence: `backend/server.js`)
- Order and delivery handlers → Access control: routes protect (evidence: `backend/routes/orderRoutes.js`)
- User handlers → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Product handlers → Product records: reads and writes (evidence: `backend/controllers/productController.js`)
- Product handlers → User records: checks seller (evidence: `backend/controllers/productController.js`)
- Product handlers → Order records: checks purchase (evidence: `backend/controllers/productController.js`)
- Order and delivery handlers → Order records: reads and writes (evidence: `backend/controllers/orderController.js`)
- Order and delivery handlers → Product records: checks and updates stock (evidence: `backend/controllers/orderController.js`)
- Order and delivery handlers → Notification records: creates alerts (evidence: `backend/controllers/orderController.js`)
- Payment handlers → Payment records: uses (evidence: `backend/controllers/paymentController.js`)
- Payment handlers → Order records: updates orders (evidence: `backend/controllers/paymentController.js`)
- Payment handlers → Notification records: creates alerts (evidence: `backend/controllers/paymentController.js`)
- Seller handlers → Product records: manages listings (evidence: `backend/controllers/sellerController.js`)
- Seller handlers → Order records: manages fulfillment (evidence: `backend/controllers/sellerController.js`)
- Seller handlers → User records: checks seller (evidence: `backend/controllers/sellerController.js`)
- Enquiry handlers → Enquiry records: reads and writes (evidence: `backend/controllers/enquiryController.js`)
- Enquiry handlers → User records: uses (evidence: `backend/controllers/enquiryController.js`)
