# pratik0192/college-major-project architecture

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

- Interactive diagram: https://gitdiagram.com/pratik0192/college-major-project
- Repository: https://github.com/pratik0192/college-major-project

## Overview

OptiVerse is an online shopping system with a customer storefront, an admin console, and an Express/MongoDB backend. The customer workflow spans product discovery, cart and wishlist management, checkout/payment, order tracking, and post-delivery reviews; account registration, email verification, and password recovery are also supported. The admin console covers product and coupon management, users, dashboards, and order-status operations. The backend entry point mounts feature routes, while controllers perform domain operations against models and external services. Some unsampled route/controller links are omitted where the excerpts do not establish them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/App.jsx) (Storefront routes), [`admin/src/App.jsx`](https://github.com/pratik0192/college-major-project/blob/main/admin/src/App.jsx) (Admin routes), [`frontend/src/context/ShopContext.jsx`](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/context/ShopContext.jsx) (Shop state and API), [`backend/controllers/orderController.js`](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/orderController.js) (Order and payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_frontend_app["Storefront routes<br/>[App.jsx]"]
  node_shop_context["Shop state and API<br/>[ShopContext.jsx]"]
  node_catalog_ui["Product browsing<br/>[Products.jsx]"]
  node_product_detail["Product detail<br/>[SinglePage.jsx]"]
  node_cart_checkout["Cart and checkout<br/>[Checkout.jsx]"]
  node_orders_ui["Order history<br/>[Order.jsx]"]
  node_wishlist_ui["Wishlist<br/>[Wishlist.jsx]"]
  node_account_ui["Account access<br/>[Login.jsx]"]
  node_navigation["Store navigation<br/>[Navbar.jsx]"]
  node_localization["Localization<br/>[i18n.js]"]
end

subgraph group_admin["Admin console"]
  node_admin_app["Admin routes<br/>[App.jsx]"]
  node_admin_login["Admin login<br/>[Login.jsx]"]
  node_admin_nav["Admin navigation<br/>[Sidebar.jsx]"]
  node_admin_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_admin_products["Product management<br/>[AddProducts.jsx]"]
  node_admin_orders["Order management<br/>[Orders.jsx]"]
  node_admin_users["User management<br/>[Users.jsx]"]
  node_admin_coupons["Coupon management<br/>[AddCoupons.jsx]"]
end

subgraph group_api["Commerce API"]
  node_api_entry["API entry and routes<br/>[index.js]"]
  node_user_routes["Account routes<br/>[userRoutes.js]"]
  node_product_routes["Product routes<br/>[productRoutes.js]"]
  node_user_controller["Account operations<br/>[userController.js]"]
  node_product_controller["Catalog operations"]
  node_order_controller["Order and payment<br/>[orderController.js]"]
  node_review_controller["Review operations"]
end

subgraph group_persistence["Domain persistence"]
  node_user_model[("User records<br/>[userModel.js]")]
  node_product_model[("Product records<br/>[productModel.js]")]
  node_order_model[("Order records<br/>[orderModel.js]")]
  node_review_model[("Review records<br/>[reviewModel.js]")]
end

subgraph group_integrations["External services"]
  node_mongo[("MongoDB")]
  node_email["Email provider<br/>[sendEmail.js]"]
  node_payments["Stripe and Razorpay<br/>[orderController.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_frontend_app
node_frontend_app -->|"routes to"| node_catalog_ui
node_frontend_app -->|"routes to"| node_product_detail
node_frontend_app -->|"routes to"| node_cart_checkout
node_frontend_app -->|"routes to"| node_orders_ui
node_frontend_app -->|"routes to"| node_wishlist_ui
node_frontend_app -->|"routes to"| node_account_ui
node_frontend_app -->|"renders"| node_navigation
node_shop_context -->|"calls API"| node_api_entry
node_shop_context -.->|"fetches catalog"| node_product_model
node_catalog_ui -->|"uses state"| node_shop_context
node_orders_ui -->|"uses state"| node_shop_context
node_wishlist_ui -->|"uses state"| node_shop_context
node_admin_app -->|"renders when logged out"| node_admin_login
node_admin_app -->|"renders"| node_admin_nav
node_admin_app -->|"routes to"| node_admin_dashboard
node_admin_app -->|"routes to"| node_admin_products
node_admin_app -->|"routes to"| node_admin_orders
node_admin_app -->|"routes to"| node_admin_users
node_admin_app -->|"routes to"| node_admin_coupons
node_api_entry -->|"mounts"| node_user_routes
node_api_entry -->|"mounts"| node_product_routes
node_api_entry -->|"connects"| node_mongo
node_user_routes -->|"dispatches"| node_user_controller
node_product_routes -->|"dispatches"| node_product_controller
node_user_controller -->|"reads/writes"| node_user_model
node_user_controller -->|"sends messages"| node_email
node_product_controller -->|"reads/writes"| node_product_model
node_order_controller -->|"reads/writes"| node_order_model
node_order_controller -->|"reads/writes"| node_user_model
node_order_controller -->|"sends messages"| node_email
node_order_controller -->|"creates/verifies"| node_payments
node_review_controller -->|"checks delivery"| node_order_model
node_review_controller -->|"reads/writes"| node_review_model
node_review_controller -->|"updates rating"| node_product_model
node_user_model -.->|"persists"| node_mongo
node_product_model -.->|"persists"| node_mongo
node_order_model -.->|"persists"| node_mongo
node_review_model -.->|"persists"| node_mongo

click node_frontend_app "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/App.jsx"
click node_shop_context "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/context/ShopContext.jsx"
click node_catalog_ui "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Products.jsx"
click node_product_detail "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/SinglePage.jsx"
click node_cart_checkout "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Checkout.jsx"
click node_orders_ui "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Order.jsx"
click node_wishlist_ui "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Wishlist.jsx"
click node_account_ui "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Login.jsx"
click node_navigation "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/components/Navbar.jsx"
click node_localization "https://github.com/pratik0192/college-major-project/blob/main/frontend/src/i18n.js"
click node_admin_app "https://github.com/pratik0192/college-major-project/blob/main/admin/src/App.jsx"
click node_admin_login "https://github.com/pratik0192/college-major-project/blob/main/admin/src/components/Login.jsx"
click node_admin_nav "https://github.com/pratik0192/college-major-project/blob/main/admin/src/components/Sidebar.jsx"
click node_admin_dashboard "https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Dashboard.jsx"
click node_admin_products "https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/AddProducts.jsx"
click node_admin_orders "https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Orders.jsx"
click node_admin_users "https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Users.jsx"
click node_admin_coupons "https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/AddCoupons.jsx"
click node_api_entry "https://github.com/pratik0192/college-major-project/blob/main/backend/index.js"
click node_user_routes "https://github.com/pratik0192/college-major-project/blob/main/backend/routes/userRoutes.js"
click node_product_routes "https://github.com/pratik0192/college-major-project/blob/main/backend/routes/productRoutes.js"
click node_user_controller "https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/userController.js"
click node_product_controller "https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/productController.js"
click node_order_controller "https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/orderController.js"
click node_review_controller "https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/reviewController.js"
click node_user_model "https://github.com/pratik0192/college-major-project/blob/main/backend/models/userModel.js"
click node_product_model "https://github.com/pratik0192/college-major-project/blob/main/backend/models/productModel.js"
click node_order_model "https://github.com/pratik0192/college-major-project/blob/main/backend/models/orderModel.js"
click node_review_model "https://github.com/pratik0192/college-major-project/blob/main/backend/models/reviewModel.js"
click node_email "https://github.com/pratik0192/college-major-project/blob/main/backend/config/sendEmail.js"
click node_payments "https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/orderController.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_frontend_app,node_shop_context,node_catalog_ui,node_product_detail,node_cart_checkout,node_orders_ui,node_wishlist_ui,node_account_ui,node_navigation,node_localization toneBlue
class node_admin_app,node_admin_login,node_admin_nav,node_admin_dashboard,node_admin_products,node_admin_orders,node_admin_users,node_admin_coupons toneAmber
class node_api_entry,node_user_routes,node_product_routes,node_user_controller,node_product_controller,node_order_controller,node_review_controller toneMint
class node_user_model,node_product_model,node_order_model,node_review_model toneRose
class node_mongo,node_email,node_payments,node_shopper toneIndigo
```

## Components

### Customer storefront

- [Storefront routes](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Shop state and API](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/context/ShopContext.jsx): `frontend/src/context/ShopContext.jsx`
- [Product browsing](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Products.jsx): `frontend/src/pages/Products.jsx`
- [Product detail](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/SinglePage.jsx): `frontend/src/pages/SinglePage.jsx`
- [Cart and checkout](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Order history](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Order.jsx): `frontend/src/pages/Order.jsx`
- [Wishlist](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Wishlist.jsx): `frontend/src/pages/Wishlist.jsx`
- [Account access](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Store navigation](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Localization](https://github.com/pratik0192/college-major-project/blob/main/frontend/src/i18n.js): `frontend/src/i18n.js`

### Admin console

- [Admin routes](https://github.com/pratik0192/college-major-project/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin login](https://github.com/pratik0192/college-major-project/blob/main/admin/src/components/Login.jsx): `admin/src/components/Login.jsx`
- [Admin navigation](https://github.com/pratik0192/college-major-project/blob/main/admin/src/components/Sidebar.jsx): `admin/src/components/Sidebar.jsx`
- [Dashboard](https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Dashboard.jsx): `admin/src/pages/Dashboard.jsx`
- [Product management](https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/AddProducts.jsx): `admin/src/pages/AddProducts.jsx`
- [Order management](https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Orders.jsx): `admin/src/pages/Orders.jsx`
- [User management](https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/Users.jsx): `admin/src/pages/Users.jsx`
- [Coupon management](https://github.com/pratik0192/college-major-project/blob/main/admin/src/pages/AddCoupons.jsx): `admin/src/pages/AddCoupons.jsx`

### Commerce API

- [API entry and routes](https://github.com/pratik0192/college-major-project/blob/main/backend/index.js): `backend/index.js`
- [Account routes](https://github.com/pratik0192/college-major-project/blob/main/backend/routes/userRoutes.js): `backend/routes/userRoutes.js`
- [Product routes](https://github.com/pratik0192/college-major-project/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Account operations](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Catalog operations](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Order and payment](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Review operations](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`

### Domain persistence

- [User records](https://github.com/pratik0192/college-major-project/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Product records](https://github.com/pratik0192/college-major-project/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [Order records](https://github.com/pratik0192/college-major-project/blob/main/backend/models/orderModel.js): `backend/models/orderModel.js`
- [Review records](https://github.com/pratik0192/college-major-project/blob/main/backend/models/reviewModel.js): `backend/models/reviewModel.js`

### External services

- **MongoDB**
- [Email provider](https://github.com/pratik0192/college-major-project/blob/main/backend/config/sendEmail.js): `backend/config/sendEmail.js`
- [Stripe and Razorpay](https://github.com/pratik0192/college-major-project/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`

### Other components

- **Shopper**

## Connections

- Shopper → Storefront routes: uses (evidence: `frontend/src/App.jsx`)
- Storefront routes → Product browsing: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Product detail: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Cart and checkout: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Order history: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Wishlist: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Account access: routes to (evidence: `frontend/src/App.jsx`)
- Storefront routes → Store navigation: renders (evidence: `frontend/src/App.jsx`)
- Shop state and API → API entry and routes: calls API (evidence: `frontend/src/context/ShopContext.jsx`)
- Shop state and API → Product records: fetches catalog
- Product browsing → Shop state and API: uses state
- Order history → Shop state and API: uses state (evidence: `frontend/src/pages/Order.jsx`)
- Wishlist → Shop state and API: uses state (evidence: `frontend/src/pages/Wishlist.jsx`)
- Admin routes → Admin login: renders when logged out (evidence: `admin/src/App.jsx`)
- Admin routes → Admin navigation: renders (evidence: `admin/src/App.jsx`)
- Admin routes → Dashboard: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Product management: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Order management: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → User management: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Coupon management: routes to (evidence: `admin/src/App.jsx`)
- API entry and routes → Account routes: mounts (evidence: `backend/index.js`)
- API entry and routes → Product routes: mounts (evidence: `backend/index.js`)
- API entry and routes → MongoDB: connects (evidence: `backend/index.js`)
- Account routes → Account operations: dispatches (evidence: `backend/routes/userRoutes.js`)
- Product routes → Catalog operations: dispatches (evidence: `backend/routes/productRoutes.js`)
- Account operations → User records: reads/writes (evidence: `backend/controllers/userController.js`)
- Account operations → Email provider: sends messages (evidence: `backend/controllers/userController.js`)
- Catalog operations → Product records: reads/writes (evidence: `backend/controllers/productController.js`)
- Order and payment → Order records: reads/writes (evidence: `backend/controllers/orderController.js`)
- Order and payment → User records: reads/writes (evidence: `backend/controllers/orderController.js`)
- Order and payment → Email provider: sends messages (evidence: `backend/controllers/orderController.js`)
- Order and payment → Stripe and Razorpay: creates/verifies (evidence: `backend/controllers/orderController.js`)
- Review operations → Order records: checks delivery (evidence: `backend/controllers/reviewController.js`)
- Review operations → Review records: reads/writes (evidence: `backend/controllers/reviewController.js`)
- Review operations → Product records: updates rating (evidence: `backend/controllers/reviewController.js`)
- User records → MongoDB: persists
- Product records → MongoDB: persists
- Order records → MongoDB: persists
- Review records → MongoDB: persists
