# harsh2code/mybag-mern architecture

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

- Interactive diagram: https://gitdiagram.com/harsh2code/mybag-mern
- Repository: https://github.com/harsh2code/mybag-mern

## Overview

MyBag is a full-stack e-commerce application. Shoppers browse products, inspect details, add items to a cart, manage account/address information, and place and pay for orders; administrators manage products and orders, while users can submit contact queries. The map follows the visible UI routing and backend routing/controller structure. Frontend-to-backend links are omitted where the supplied excerpts do not establish the runtime request path; several unsampled capabilities are represented by their exact paths from the tree.

Main entry points: [`MyBag/UI/src/App.jsx`](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/App.jsx) (App routing), [`MyBag/BackEnd/server.js`](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/server.js) (HTTP API server), [`MyBag/UI/src/pages/Shopping-View/home.jsx`](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/home.jsx) (Product discovery), [`MyBag/BackEnd/Controllers/Shop/order-controller.js`](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/order-controller.js) (Order and PayPal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_catalog_ui["Product discovery<br/>[home.jsx]"]
  node_product_detail["Product details"]
  node_checkout["Checkout and payment<br/>[Checkout.jsx]"]
  node_account_ui["Account and address<br/>[account.jsx]"]
  node_orders_ui["Order history<br/>[orders.jsx]"]
  node_auth_ui["Sign-in state<br/>[authSlice.js]"]
  node_product_state["Product state<br/>[ProductSlice.js]"]
  node_cart_state["Cart state<br/>[cart-Slice.js]"]
  node_address_state["Address state<br/>[Address-Slice.js]"]
  node_order_state["Order state<br/>[OrderSlice.js]"]
end

subgraph group_shop["Shopping services"]
  node_cart_routes["Cart routes<br/>[Cart-routes.js]"]
  node_cart_controller["Cart operations<br/>[Cart-controller.js]"]
  node_cart_model[("Cart records<br/>[Cart.js]")]
  node_address_routes["Address routes<br/>[address-routes.js]"]
  node_address_controller["Address operations"]
  node_product_routes["Catalog routes<br/>[Product-Routes.js]"]
  node_product_controller["Catalog operations"]
  node_product_model[("Product records<br/>[Product.js]")]
  node_order_routes["Order and payment routes<br/>[order-routes.js]"]
  node_order_controller["Order and PayPal"]
  node_payment_capture["Payment capture<br/>[capturePayment.js]"]
  node_order_model[("Order records<br/>[Order.js]")]
end

subgraph group_admin["Administration"]
  node_admin_products["Product management<br/>[Products.jsx]"]
  node_admin_product_state["Admin product state<br/>[productSlice.js]"]
  node_admin_product_routes["Admin product routes<br/>[products-routes.js]"]
  node_admin_product_controller["Product administration"]
  node_image_storage["Image upload<br/>[Cloudinary.js]"]
end

subgraph group_identity["Identity and data"]
  node_server["HTTP API server<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[auth-routes.js]"]
  node_auth_controller["Authentication"]
  node_user_model[("User records<br/>[User.js]")]
end

node_shopper(("Shopper"))
node_admin_actor(("Administrator"))

node_shopper -->|"opens"| node_app
node_admin_actor -->|"opens"| node_app
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_account_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_admin_products
node_app -->|"dispatches"| node_auth_ui
node_catalog_ui -->|"dispatches"| node_product_state
node_catalog_ui -->|"renders"| node_product_detail
node_catalog_ui -->|"dispatches"| node_cart_state
node_product_detail -->|"dispatches"| node_cart_state
node_checkout -.->|"uses"| node_address_state
node_checkout -.->|"uses"| node_order_state
node_account_ui -.->|"uses"| node_address_state
node_orders_ui -.->|"uses"| node_order_state
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_cart_routes
node_server -->|"mounts"| node_address_routes
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_order_routes
node_server -->|"mounts"| node_admin_product_routes
node_auth_routes -->|"routes to"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_cart_routes -->|"routes to"| node_cart_controller
node_cart_controller -->|"reads and writes"| node_cart_model
node_cart_controller -->|"reads"| node_product_model
node_address_routes -->|"routes to"| node_address_controller
node_product_routes -->|"routes to"| node_product_controller
node_product_controller -->|"reads"| node_product_model
node_order_routes -->|"routes to"| node_order_controller
node_order_routes -->|"routes to"| node_payment_capture
node_order_controller -->|"reads and writes"| node_order_model
node_order_controller -->|"reads"| node_cart_model
node_order_controller -->|"reads"| node_product_model
node_admin_products -->|"uses"| node_admin_product_state
node_admin_product_routes -->|"routes to"| node_admin_product_controller
node_admin_product_controller -->|"reads and writes"| node_product_model
node_admin_product_controller -->|"uploads images"| node_image_storage

click node_app "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/App.jsx"
click node_catalog_ui "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/home.jsx"
click node_product_detail "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/Components/shopping/product-details.jsx"
click node_checkout "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/Checkout.jsx"
click node_account_ui "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/account.jsx"
click node_orders_ui "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/orders.jsx"
click node_auth_ui "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/authSlice/authSlice.js"
click node_product_state "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Product-Slice/ProductSlice.js"
click node_cart_state "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/cart-slice/cart-Slice.js"
click node_address_state "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Address-Slice/Address-Slice.js"
click node_order_state "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Order-Slice/OrderSlice.js"
click node_server "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/server.js"
click node_auth_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/auth/auth-routes.js"
click node_auth_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/auth/auth-controllers.js"
click node_user_model "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/User.js"
click node_cart_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/Cart-routes.js"
click node_cart_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Cart-controller.js"
click node_cart_model "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Cart.js"
click node_address_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/address-routes.js"
click node_address_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Address-controller.js"
click node_product_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/Product-Routes.js"
click node_product_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Product-Controller.js"
click node_product_model "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Product.js"
click node_order_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/order-routes.js"
click node_order_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/order-controller.js"
click node_payment_capture "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/capturePayment.js"
click node_order_model "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Order.js"
click node_admin_products "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Admin-View/Products.jsx"
click node_admin_product_state "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/admin/product-slice/productSlice.js"
click node_admin_product_routes "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/admin/products-routes.js"
click node_admin_product_controller "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/admin/product-controllers.js"
click node_image_storage "https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/helpers/Cloudinary.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_ui,node_product_detail,node_checkout,node_account_ui,node_orders_ui,node_auth_ui,node_product_state,node_cart_state,node_address_state,node_order_state toneBlue
class node_cart_routes,node_cart_controller,node_cart_model,node_address_routes,node_address_controller,node_product_routes,node_product_controller,node_product_model,node_order_routes,node_order_controller,node_payment_capture,node_order_model toneAmber
class node_admin_products,node_admin_product_state,node_admin_product_routes,node_admin_product_controller,node_image_storage toneMint
class node_server,node_auth_routes,node_auth_controller,node_user_model toneRose
class node_shopper,node_admin_actor toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/App.jsx): `MyBag/UI/src/App.jsx`
- [Product discovery](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/home.jsx): `MyBag/UI/src/pages/Shopping-View/home.jsx`
- [Product details](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/Components/shopping/product-details.jsx): `MyBag/UI/src/Components/shopping/product-details.jsx`
- [Checkout and payment](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/Checkout.jsx): `MyBag/UI/src/pages/Shopping-View/Checkout.jsx`
- [Account and address](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/account.jsx): `MyBag/UI/src/pages/Shopping-View/account.jsx`
- [Order history](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Shopping-View/orders.jsx): `MyBag/UI/src/pages/Shopping-View/orders.jsx`
- [Sign-in state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/authSlice/authSlice.js): `MyBag/UI/src/store/authSlice/authSlice.js`
- [Product state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Product-Slice/ProductSlice.js): `MyBag/UI/src/store/Shop/Product-Slice/ProductSlice.js`
- [Cart state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/cart-slice/cart-Slice.js): `MyBag/UI/src/store/cart-slice/cart-Slice.js`
- [Address state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Address-Slice/Address-Slice.js): `MyBag/UI/src/store/Shop/Address-Slice/Address-Slice.js`
- [Order state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/Shop/Order-Slice/OrderSlice.js): `MyBag/UI/src/store/Shop/Order-Slice/OrderSlice.js`

### Shopping services

- [Cart routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/Cart-routes.js): `MyBag/BackEnd/routers/Shop/Cart-routes.js`
- [Cart operations](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Cart-controller.js): `MyBag/BackEnd/Controllers/Shop/Cart-controller.js`
- [Cart records](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Cart.js): `MyBag/BackEnd/models/Cart.js`
- [Address routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/address-routes.js): `MyBag/BackEnd/routers/Shop/address-routes.js`
- [Address operations](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Address-controller.js): `MyBag/BackEnd/Controllers/Shop/Address-controller.js`
- [Catalog routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/Product-Routes.js): `MyBag/BackEnd/routers/Shop/Product-Routes.js`
- [Catalog operations](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/Product-Controller.js): `MyBag/BackEnd/Controllers/Shop/Product-Controller.js`
- [Product records](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Product.js): `MyBag/BackEnd/models/Product.js`
- [Order and payment routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/Shop/order-routes.js): `MyBag/BackEnd/routers/Shop/order-routes.js`
- [Order and PayPal](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/order-controller.js): `MyBag/BackEnd/Controllers/Shop/order-controller.js`
- [Payment capture](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/Shop/capturePayment.js): `MyBag/BackEnd/Controllers/Shop/capturePayment.js`
- [Order records](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/Order.js): `MyBag/BackEnd/models/Order.js`

### Administration

- [Product management](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/pages/Admin-View/Products.jsx): `MyBag/UI/src/pages/Admin-View/Products.jsx`
- [Admin product state](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/UI/src/store/admin/product-slice/productSlice.js): `MyBag/UI/src/store/admin/product-slice/productSlice.js`
- [Admin product routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/admin/products-routes.js): `MyBag/BackEnd/routers/admin/products-routes.js`
- [Product administration](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/admin/product-controllers.js): `MyBag/BackEnd/Controllers/admin/product-controllers.js`
- [Image upload](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/helpers/Cloudinary.js): `MyBag/BackEnd/helpers/Cloudinary.js`

### Identity and data

- [HTTP API server](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/server.js): `MyBag/BackEnd/server.js`
- [Authentication routes](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/routers/auth/auth-routes.js): `MyBag/BackEnd/routers/auth/auth-routes.js`
- [Authentication](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/Controllers/auth/auth-controllers.js): `MyBag/BackEnd/Controllers/auth/auth-controllers.js`
- [User records](https://github.com/harsh2code/mybag-mern/blob/main/MyBag/BackEnd/models/User.js): `MyBag/BackEnd/models/User.js`

### Other components

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

## Connections

- Shopper → App routing: opens (evidence: `MyBag/UI/src/App.jsx`)
- Administrator → App routing: opens (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Product discovery: routes to (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Checkout and payment: routes to (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Account and address: routes to (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Order history: routes to (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Product management: routes to (evidence: `MyBag/UI/src/App.jsx`)
- App routing → Sign-in state: dispatches (evidence: `MyBag/UI/src/App.jsx`)
- Product discovery → Product state: dispatches (evidence: `MyBag/UI/src/pages/Shopping-View/home.jsx`)
- Product discovery → Product details: renders (evidence: `MyBag/UI/src/pages/Shopping-View/home.jsx`)
- Product discovery → Cart state: dispatches (evidence: `MyBag/UI/src/pages/Shopping-View/home.jsx`)
- Product details → Cart state: dispatches (evidence: `MyBag/UI/src/Components/shopping/product-details.jsx`)
- Checkout and payment → Address state: uses
- Checkout and payment → Order state: uses
- Account and address → Address state: uses
- Order history → Order state: uses
- HTTP API server → Authentication routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- HTTP API server → Cart routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- HTTP API server → Address routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- HTTP API server → Catalog routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- HTTP API server → Order and payment routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- HTTP API server → Admin product routes: mounts (evidence: `MyBag/BackEnd/server.js`)
- Authentication routes → Authentication: routes to (evidence: `MyBag/BackEnd/routers/auth/auth-routes.js`)
- Authentication → User records: reads and writes (evidence: `MyBag/BackEnd/Controllers/auth/auth-controllers.js`)
- Cart routes → Cart operations: routes to (evidence: `MyBag/BackEnd/routers/Shop/Cart-routes.js`)
- Cart operations → Cart records: reads and writes (evidence: `MyBag/BackEnd/Controllers/Shop/Cart-controller.js`)
- Cart operations → Product records: reads (evidence: `MyBag/BackEnd/Controllers/Shop/Cart-controller.js`)
- Address routes → Address operations: routes to (evidence: `MyBag/BackEnd/routers/Shop/address-routes.js`)
- Catalog routes → Catalog operations: routes to (evidence: `MyBag/BackEnd/routers/Shop/Product-Routes.js`)
- Catalog operations → Product records: reads (evidence: `MyBag/BackEnd/Controllers/Shop/Product-Controller.js`)
- Order and payment routes → Order and PayPal: routes to (evidence: `MyBag/BackEnd/routers/Shop/order-routes.js`)
- Order and payment routes → Payment capture: routes to (evidence: `MyBag/BackEnd/routers/Shop/order-routes.js`)
- Order and PayPal → Order records: reads and writes (evidence: `MyBag/BackEnd/Controllers/Shop/order-controller.js`)
- Order and PayPal → Cart records: reads (evidence: `MyBag/BackEnd/Controllers/Shop/order-controller.js`)
- Order and PayPal → Product records: reads (evidence: `MyBag/BackEnd/Controllers/Shop/order-controller.js`)
- Product management → Admin product state: uses (evidence: `MyBag/UI/src/pages/Admin-View/Products.jsx`)
- Admin product routes → Product administration: routes to (evidence: `MyBag/BackEnd/routers/admin/products-routes.js`)
- Product administration → Product records: reads and writes (evidence: `MyBag/BackEnd/Controllers/admin/product-controllers.js`)
- Product administration → Image upload: uploads images (evidence: `MyBag/BackEnd/Controllers/admin/product-controllers.js`)
