# yukith1411/grand-bazaar architecture

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

- Interactive diagram: https://gitdiagram.com/yukith1411/grand-bazaar
- Repository: https://github.com/yukith1411/grand-bazaar

## Overview

Grand Bazaar is a department-store e-commerce application: shoppers browse and review products, manage accounts and carts, and place and track orders; administrators manage catalog content, orders, users, promotions, and storefront banners. The React app routes users into storefront or guarded admin pages, while the Express API dispatches domain routes to handlers backed by MongoDB. Cloudinary supports product-image uploads. Several frontend-to-API calls and unsampled handlers are not visible in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/App.jsx) (React app routing), [`backend/server.js`](https://github.com/yukith1411/grand-bazaar/blob/main/backend/server.js) (Express API dispatcher), [`backend/controllers/productController.js`](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/productController.js) (Catalog handlers), [`backend/controllers/orderController.js`](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/orderController.js) (Order handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["React app routing<br/>[App.jsx]"]
  node_catalog["Catalog browsing<br/>[Shop.jsx]"]
  node_product_view["Product details<br/>[ProductDetails.jsx]"]
  node_cart_checkout["Cart and checkout<br/>[Checkout.jsx]"]
  node_orders_view["Order history<br/>[Orders.jsx]"]
  node_account["Account and profile<br/>[AuthContext.jsx]"]
  node_wishlist["Wishlist"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin management"]
end

subgraph group_api["API"]
  node_api_server["Express API dispatcher<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_product_routes["Product routes<br/>[productRoutes.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_review_routes["Review routes<br/>[reviewRoutes.js]"]
  node_banner_routes["Banner routes<br/>[bannerRoutes.js]"]
  node_auth_handlers["Account handlers<br/>[authController.js]"]
  node_product_handlers["Catalog handlers"]
  node_order_handlers["Order handlers<br/>[orderController.js]"]
  node_review_handlers["Review handlers"]
  node_domain_handlers["Other domain handlers"]
end

subgraph group_data["Data and media"]
  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_review_store[("Review records<br/>[Review.js]")]
  node_other_stores[("Other domain records")]
  node_cloudinary["Cloudinary media"]
end

node_shopper(("Shopper"))
node_administrator(("Administrator"))

node_shopper -->|"uses"| node_app
node_administrator -->|"uses"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_product_view
node_app -->|"routes to"| node_cart_checkout
node_app -->|"routes to"| node_orders_view
node_app -->|"provides context"| node_account
node_app -->|"provides context"| node_wishlist
node_app -->|"routes to"| node_admin_pages
node_api_server -->|"mounts"| node_auth_routes
node_api_server -->|"mounts"| node_product_routes
node_api_server -->|"mounts"| node_order_routes
node_api_server -->|"mounts"| node_review_routes
node_api_server -->|"mounts"| node_banner_routes
node_auth_routes -->|"dispatches"| node_auth_handlers
node_product_routes -->|"dispatches"| node_product_handlers
node_order_routes -->|"dispatches"| node_order_handlers
node_review_routes -->|"dispatches"| node_review_handlers
node_banner_routes -->|"dispatches"| node_domain_handlers
node_auth_handlers -->|"reads and writes"| node_user_store
node_product_handlers -->|"queries and updates"| node_product_store
node_product_handlers -->|"looks up category and brand"| node_other_stores
node_product_handlers -->|"uploads images"| node_cloudinary
node_order_handlers -->|"creates and queries"| node_order_store
node_order_handlers -->|"checks and adjusts stock"| node_product_store
node_order_handlers -->|"clears cart"| node_user_store
node_review_handlers -->|"creates and queries"| node_review_store
node_review_handlers -->|"links and rates"| node_product_store
node_cart_checkout -.->|"submits requests"| node_api_server
node_catalog -.->|"requests catalog"| node_api_server
node_admin_pages -.->|"manages records"| node_api_server

click node_app "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/App.jsx"
click node_catalog "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Shop.jsx"
click node_product_view "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/ProductDetails.jsx"
click node_cart_checkout "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Checkout.jsx"
click node_orders_view "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Orders.jsx"
click node_account "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/context/AuthContext.jsx"
click node_wishlist "https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/context/WishlistContext.jsx"
click node_admin_pages "https://github.com/yukith1411/grand-bazaar/tree/main/frontend/src/pages/admin"
click node_api_server "https://github.com/yukith1411/grand-bazaar/blob/main/backend/server.js"
click node_auth_routes "https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/authRoutes.js"
click node_product_routes "https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/productRoutes.js"
click node_order_routes "https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/orderRoutes.js"
click node_review_routes "https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/reviewRoutes.js"
click node_banner_routes "https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/bannerRoutes.js"
click node_auth_handlers "https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/authController.js"
click node_product_handlers "https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/productController.js"
click node_order_handlers "https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/orderController.js"
click node_review_handlers "https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/reviewController.js"
click node_domain_handlers "https://github.com/yukith1411/grand-bazaar/tree/main/backend/controllers"
click node_user_store "https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/User.js"
click node_product_store "https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Product.js"
click node_order_store "https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Order.js"
click node_review_store "https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Review.js"
click node_other_stores "https://github.com/yukith1411/grand-bazaar/tree/main/backend/models"
click node_cloudinary "https://github.com/yukith1411/grand-bazaar/blob/main/backend/utils/cloudinaryHelper.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,node_product_view,node_cart_checkout,node_orders_view,node_account,node_wishlist toneBlue
class node_admin_pages toneAmber
class node_api_server,node_auth_routes,node_product_routes,node_order_routes,node_review_routes,node_banner_routes,node_auth_handlers,node_product_handlers,node_order_handlers,node_review_handlers,node_domain_handlers toneMint
class node_user_store,node_product_store,node_order_store,node_review_store,node_other_stores,node_cloudinary toneRose
class node_shopper,node_administrator toneIndigo
```

## Components

### Storefront

- [React app routing](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Catalog browsing](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Shop.jsx): `frontend/src/pages/user/Shop.jsx`
- [Product details](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/ProductDetails.jsx): `frontend/src/pages/user/ProductDetails.jsx`
- [Cart and checkout](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Checkout.jsx): `frontend/src/pages/user/Checkout.jsx`
- [Order history](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/pages/user/Orders.jsx): `frontend/src/pages/user/Orders.jsx`
- [Account and profile](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Wishlist](https://github.com/yukith1411/grand-bazaar/blob/main/frontend/src/context/WishlistContext.jsx): `frontend/src/context/WishlistContext.jsx`

### Administration

- [Admin management](https://github.com/yukith1411/grand-bazaar/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`

### API

- [Express API dispatcher](https://github.com/yukith1411/grand-bazaar/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Product routes](https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Order routes](https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Review routes](https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/reviewRoutes.js): `backend/routes/reviewRoutes.js`
- [Banner routes](https://github.com/yukith1411/grand-bazaar/blob/main/backend/routes/bannerRoutes.js): `backend/routes/bannerRoutes.js`
- [Account handlers](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Catalog handlers](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Order handlers](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Review handlers](https://github.com/yukith1411/grand-bazaar/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Other domain handlers](https://github.com/yukith1411/grand-bazaar/tree/main/backend/controllers): `backend/controllers`

### Data and media

- [User records](https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/User.js): `backend/models/User.js`
- [Product records](https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Order records](https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Review records](https://github.com/yukith1411/grand-bazaar/blob/main/backend/models/Review.js): `backend/models/Review.js`
- [Other domain records](https://github.com/yukith1411/grand-bazaar/tree/main/backend/models): `backend/models`
- [Cloudinary media](https://github.com/yukith1411/grand-bazaar/blob/main/backend/utils/cloudinaryHelper.js): `backend/utils/cloudinaryHelper.js`

### Other components

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

## Connections

- Shopper → React app routing: uses (evidence: `frontend/src/App.jsx`)
- Administrator → React app routing: uses (evidence: `frontend/src/App.jsx`)
- React app routing → Catalog browsing: routes to (evidence: `frontend/src/App.jsx`)
- React app routing → Product details: routes to (evidence: `frontend/src/App.jsx`)
- React app routing → Cart and checkout: routes to (evidence: `frontend/src/App.jsx`)
- React app routing → Order history: routes to (evidence: `frontend/src/App.jsx`)
- React app routing → Account and profile: provides context (evidence: `frontend/src/App.jsx`)
- React app routing → Wishlist: provides context (evidence: `frontend/src/App.jsx`)
- React app routing → Admin management: routes to (evidence: `frontend/src/App.jsx`)
- Express API dispatcher → Auth routes: mounts (evidence: `backend/server.js`)
- Express API dispatcher → Product routes: mounts (evidence: `backend/server.js`)
- Express API dispatcher → Order routes: mounts (evidence: `backend/server.js`)
- Express API dispatcher → Review routes: mounts (evidence: `backend/server.js`)
- Express API dispatcher → Banner routes: mounts (evidence: `backend/server.js`)
- Auth routes → Account handlers: dispatches (evidence: `backend/routes/authRoutes.js`)
- Product routes → Catalog handlers: dispatches (evidence: `backend/routes/productRoutes.js`)
- Order routes → Order handlers: dispatches (evidence: `backend/routes/orderRoutes.js`)
- Review routes → Review handlers: dispatches (evidence: `backend/routes/reviewRoutes.js`)
- Banner routes → Other domain handlers: dispatches (evidence: `backend/routes/bannerRoutes.js`)
- Account handlers → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Catalog handlers → Product records: queries and updates (evidence: `backend/controllers/productController.js`)
- Catalog handlers → Other domain records: looks up category and brand (evidence: `backend/controllers/productController.js`)
- Catalog handlers → Cloudinary media: uploads images (evidence: `backend/controllers/productController.js`)
- Order handlers → Order records: creates and queries (evidence: `backend/controllers/orderController.js`)
- Order handlers → Product records: checks and adjusts stock (evidence: `backend/controllers/orderController.js`)
- Order handlers → User records: clears cart (evidence: `backend/controllers/orderController.js`)
- Review handlers → Review records: creates and queries (evidence: `backend/controllers/reviewController.js`)
- Review handlers → Product records: links and rates (evidence: `backend/controllers/reviewController.js`)
- Cart and checkout → Express API dispatcher: submits requests
- Catalog browsing → Express API dispatcher: requests catalog
- Admin management → Express API dispatcher: manages records
