# taimoorhussain45/finalyearproject architecture

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

- Interactive diagram: https://gitdiagram.com/taimoorhussain45/finalyearproject
- Repository: https://github.com/taimoorhussain45/finalyearproject

## Overview

This is a React/Express/MongoDB e-commerce platform. Shoppers browse products, manage a cart, check out, and follow orders; administrators manage products, inventory, payments, and platform operations. The graph includes documented marketing, loyalty, returns, reviews, and notification capabilities. Source excerpts show the application routing, cart/API boundary, and selected backend calls; links for unsampled subsystems rely on explicit README or source-index references, so uncertain runtime connections are omitted.

Main entry points: [`backend/app.js`](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/app.js) (Express API), [`src/services/apiService.js`](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/services/apiService.js) (API Client), [`backend/controllers/orderController.js`](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/orderController.js) (Order Processing), [`backend/controllers/paymentController.js`](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/paymentController.js) (Payment Processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App Router<br/>[App.jsx]"]
  node_cart["Cart &amp; Auth State<br/>[CartContext.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_api["API Client<br/>[apiService.js]"]
  node_api_routes["API Route Map<br/>[api.js]"]
end

subgraph group_commerce["Commerce Services"]
  node_server["Express API<br/>[app.js]"]
  node_orders["Order Processing<br/>[orderController.js]"]
  node_order_data[("Order Records<br/>[Order.js]")]
  node_payments["Payment Processing"]
  node_payment_data[("Payment Records<br/>[Payment.js]")]
  node_products["Product Catalog"]
  node_product_data[("Product Records<br/>[product.js]")]
  node_reviews["Reviews"]
  node_review_data[("Review Records<br/>[Review.js]")]
  node_returns["Returns"]
  node_return_data[("Return Records<br/>[Return.js]")]
end

subgraph group_operations["Admin Operations"]
  node_admin_ui["Admin Workspace<br/>[AdminPanel.jsx]"]
  node_product_admin["Product Management"]
  node_inventory_ui["Inventory Management"]
  node_payment_admin["Payment Management"]
  node_marketing["Marketing &amp; Loyalty"]
end

subgraph group_platform["Platform Services"]
  node_notification["Notifications"]
  node_notification_data[("Notification Records<br/>[Notification.js]")]
  node_auth["Authentication<br/>[auth.js]"]
  node_admin_auth["Admin Authorization<br/>[adminMiddleware.js]"]
  node_user_data[("User Records<br/>[User.js]")]
end

node_shopper(("Shopper"))
node_stripe{{"Stripe"}}
node_mongo[("MongoDB")]

node_shopper -->|"uses"| node_app
node_app -->|"uses"| node_cart
node_app -->|"routes to"| node_checkout
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"requests"| node_api
node_cart -->|"requests"| node_api
node_cart -->|"uses endpoints"| node_api_routes
node_api -->|"uses endpoints"| node_api_routes
node_api -.->|"HTTP requests"| node_server
node_server -->|"mounts routes"| node_orders
node_server -->|"mounts routes"| node_products
node_server -->|"mounts routes"| node_reviews
node_server -->|"mounts routes"| node_payments
node_server -->|"mounts routes"| node_returns
node_server -->|"mounts routes"| node_marketing
node_server -->|"mounts routes"| node_notification
node_orders -->|"reads and writes"| node_order_data
node_orders -->|"creates notices"| node_notification_data
node_orders -->|"increments promo use"| node_marketing
node_payments -->|"reads and writes"| node_payment_data
node_payments -->|"reads and updates"| node_order_data
node_payments -->|"processes payments"| node_stripe
node_products -.->|"manages products"| node_product_data
node_reviews -->|"manages reviews"| node_review_data
node_returns -.->|"manages returns"| node_return_data
node_returns -.->|"requests notices"| node_notification
node_notification -.->|"manages notices"| node_notification_data
node_admin_ui -.->|"hosts"| node_product_admin
node_admin_ui -.->|"routes to"| node_inventory_ui
node_product_admin -->|"requests"| node_api
node_inventory_ui -->|"requests"| node_api
node_payment_admin -->|"requests"| node_api
node_marketing -->|"dispatches notices"| node_notification
node_auth -.->|"validates identity"| node_user_data
node_admin_auth -->|"checks role"| node_user_data
node_mongo -.->|"stores records"| node_order_data
node_mongo -.->|"stores records"| node_payment_data
node_mongo -.->|"stores records"| node_product_data
node_mongo -.->|"stores records"| node_user_data

click node_app "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/App.jsx"
click node_cart "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Context/CartContext.jsx"
click node_checkout "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/component/Checkout/Checkout.jsx"
click node_api "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/services/apiService.js"
click node_api_routes "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/constant/api.js"
click node_server "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/app.js"
click node_orders "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/orderController.js"
click node_order_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Order.js"
click node_payments "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/paymentController.js"
click node_payment_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Payment.js"
click node_products "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/productController.js"
click node_product_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/product.js"
click node_reviews "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/reviewController.js"
click node_review_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Review.js"
click node_returns "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/returnController.js"
click node_return_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Return.js"
click node_admin_ui "https://github.com/taimoorhussain45/finalyearproject/blob/main/AdminPanel/AdminPanel.jsx"
click node_product_admin "https://github.com/taimoorhussain45/finalyearproject/blob/main/AdminPanel/ProductManagement.jsx"
click node_inventory_ui "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Pages/InventoryManagement.jsx"
click node_payment_admin "https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Pages/PaymentManagement.jsx"
click node_marketing "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/marketingController.js"
click node_notification "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/notificationController.js"
click node_notification_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Notification.js"
click node_auth "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/middlewares/auth.js"
click node_admin_auth "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/middlewares/adminMiddleware.js"
click node_user_data "https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/User.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_cart,node_checkout,node_api,node_api_routes toneBlue
class node_server,node_orders,node_order_data,node_payments,node_payment_data,node_products,node_product_data,node_reviews,node_review_data,node_returns,node_return_data,node_mongo toneAmber
class node_admin_ui,node_product_admin,node_inventory_ui,node_payment_admin,node_marketing toneMint
class node_notification,node_notification_data,node_auth,node_admin_auth,node_user_data toneRose
class node_shopper,node_stripe toneIndigo
```

## Components

### Storefront

- [App Router](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/App.jsx): `src/App.jsx`
- [Cart & Auth State](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Context/CartContext.jsx): `src/Context/CartContext.jsx`
- [Checkout](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/component/Checkout/Checkout.jsx): `src/component/Checkout/Checkout.jsx`
- [API Client](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/services/apiService.js): `src/services/apiService.js`
- [API Route Map](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/constant/api.js): `src/constant/api.js`

### Commerce Services

- [Express API](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/app.js): `backend/app.js`
- [Order Processing](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Order Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Payment Processing](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/paymentController.js): `backend/controllers/paymentController.js`
- [Payment Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Payment.js): `backend/models/Payment.js`
- [Product Catalog](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/product.js): `backend/models/product.js`
- [Reviews](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Review Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Review.js): `backend/models/Review.js`
- [Returns](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/returnController.js): `backend/controllers/returnController.js`
- [Return Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Return.js): `backend/models/Return.js`

### Admin Operations

- [Admin Workspace](https://github.com/taimoorhussain45/finalyearproject/blob/main/AdminPanel/AdminPanel.jsx): `AdminPanel/AdminPanel.jsx`
- [Product Management](https://github.com/taimoorhussain45/finalyearproject/blob/main/AdminPanel/ProductManagement.jsx): `AdminPanel/ProductManagement.jsx`
- [Inventory Management](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Pages/InventoryManagement.jsx): `src/Pages/InventoryManagement.jsx`
- [Payment Management](https://github.com/taimoorhussain45/finalyearproject/blob/main/src/Pages/PaymentManagement.jsx): `src/Pages/PaymentManagement.jsx`
- [Marketing & Loyalty](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/marketingController.js): `backend/controllers/marketingController.js`

### Platform Services

- [Notifications](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/controllers/notificationController.js): `backend/controllers/notificationController.js`
- [Notification Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/Notification.js): `backend/models/Notification.js`
- [Authentication](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/middlewares/auth.js): `backend/middlewares/auth.js`
- [Admin Authorization](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/middlewares/adminMiddleware.js): `backend/middlewares/adminMiddleware.js`
- [User Records](https://github.com/taimoorhussain45/finalyearproject/blob/main/backend/models/User.js): `backend/models/User.js`

### Other components

- **Shopper**
- **Stripe**
- **MongoDB**

## Connections

- Shopper → App Router: uses (evidence: `src/App.jsx`)
- App Router → Cart & Auth State: uses (evidence: `src/App.jsx`)
- App Router → Checkout: routes to (evidence: `src/App.jsx`)
- Checkout → Cart & Auth State: reads cart (evidence: `src/component/Checkout/Checkout.jsx`)
- Checkout → API Client: requests (evidence: `src/component/Checkout/Checkout.jsx`)
- Cart & Auth State → API Client: requests (evidence: `src/Context/CartContext.jsx`)
- Cart & Auth State → API Route Map: uses endpoints (evidence: `src/Context/CartContext.jsx`)
- API Client → API Route Map: uses endpoints (evidence: `src/services/apiService.js`)
- API Client → Express API: HTTP requests
- Express API → Order Processing: mounts routes (evidence: `backend/app.js`)
- Express API → Product Catalog: mounts routes (evidence: `backend/app.js`)
- Express API → Reviews: mounts routes (evidence: `backend/app.js`)
- Express API → Payment Processing: mounts routes (evidence: `backend/app.js`)
- Express API → Returns: mounts routes (evidence: `backend/app.js`)
- Express API → Marketing & Loyalty: mounts routes (evidence: `backend/app.js`)
- Express API → Notifications: mounts routes (evidence: `backend/app.js`)
- Order Processing → Order Records: reads and writes (evidence: `backend/controllers/orderController.js`)
- Order Processing → Notification Records: creates notices (evidence: `backend/controllers/orderController.js`)
- Order Processing → Marketing & Loyalty: increments promo use (evidence: `backend/controllers/orderController.js`)
- Payment Processing → Payment Records: reads and writes (evidence: `backend/controllers/paymentController.js`)
- Payment Processing → Order Records: reads and updates (evidence: `backend/controllers/paymentController.js`)
- Payment Processing → Stripe: processes payments (evidence: `backend/controllers/paymentController.js`)
- Product Catalog → Product Records: manages products
- Reviews → Review Records: manages reviews (evidence: `backend/controllers/reviewController.js`)
- Returns → Return Records: manages returns (evidence: `backend/controllers/returnController.js`)
- Returns → Notifications: requests notices (evidence: `backend/controllers/returnController.js`)
- Notifications → Notification Records: manages notices (evidence: `backend/controllers/notificationController.js`)
- Admin Workspace → Product Management: hosts
- Admin Workspace → Inventory Management: routes to
- Product Management → API Client: requests (evidence: `AdminPanel/ProductManagement.jsx`)
- Inventory Management → API Client: requests (evidence: `src/Pages/InventoryManagement.jsx`)
- Payment Management → API Client: requests (evidence: `src/Pages/PaymentManagement.jsx`)
- Marketing & Loyalty → Notifications: dispatches notices (evidence: `backend/controllers/marketingController.js`)
- Authentication → User Records: validates identity
- Admin Authorization → User Records: checks role (evidence: `backend/middlewares/adminMiddleware.js`)
- MongoDB → Order Records: stores records
- MongoDB → Payment Records: stores records
- MongoDB → Product Records: stores records
- MongoDB → User Records: stores records
