# utkarshgupta05/e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/utkarshgupta05/e-commerce
- Repository: https://github.com/utkarshgupta05/e-commerce

## Overview

This is a clothing-commerce application with a customer storefront, an Express/MongoDB API, and a separate administration console. Customers browse products, manage a size-specific cart, authenticate, and place orders using cash on delivery or online payment; they can then view orders. Administrators authenticate to manage products and order status. The graph includes the major storefront and admin flows plus the API’s principal domain controllers and persistence. Some connections are supported only by the SOURCE INDEX or HTTP paths; unsampled implementation details are not inferred.

Main entry points: [`Backend/server.js`](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/server.js) (HTTP API), [`Frontend/src/App.jsx`](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/App.jsx) (Storefront routes), [`Frontend/src/context/ShopContext.jsx`](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/context/ShopContext.jsx) (Shop state), [`admin/src/App.jsx`](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/App.jsx) (Admin routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_storefront_app["Storefront routes<br/>[App.jsx]"]
  node_catalog_browse["Browse catalog<br/>[Collection.jsx]"]
  node_product_detail["Product details<br/>[Product.jsx]"]
  node_shop_context["Shop state<br/>[ShopContext.jsx]"]
  node_cart["Shopping cart<br/>[Cart.jsx]"]
  node_checkout["Checkout<br/>[PlaceOrder.jsx]"]
  node_payment_verify["Payment verification<br/>[Verify.jsx]"]
  node_customer_orders["Customer orders<br/>[Orders.jsx]"]
  node_customer_login["Customer login<br/>[Login.jsx]"]
end

subgraph group_backend["Commerce API"]
  node_api["HTTP API<br/>[server.js]"]
  node_user_routes["User endpoints<br/>[userRoute.js]"]
  node_product_routes["Product endpoints<br/>[productRoute.js]"]
  node_cart_routes["Cart endpoints<br/>[cartRoute.js]"]
  node_order_routes["Order endpoints<br/>[orderRoute.js]"]
  node_user_controller["Identity services<br/>[userController.js]"]
  node_product_controller["Catalog services"]
  node_cart_controller["Cart services<br/>[cartController.js]"]
  node_order_controller["Order and payment<br/>[orderController.js]"]
end

subgraph group_admin["Admin console"]
  node_admin_app["Admin routes<br/>[App.jsx]"]
  node_admin_login["Admin login<br/>[Login.jsx]"]
  node_product_management["Product management<br/>[Add.jsx]"]
  node_product_list["Product list<br/>[List.jsx]"]
  node_order_management["Order management<br/>[Orders.jsx]"]
end

subgraph group_data["Persistence and media"]
  node_users[("User records<br/>[userModel.js]")]
  node_products[("Product records<br/>[productModel.js]")]
  node_orders[("Order records<br/>[orderModel.js]")]
  node_media_store["Image hosting<br/>[cloudinary.js]"]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_storefront_app
node_storefront_app -->|"routes to"| node_catalog_browse
node_storefront_app -->|"routes to"| node_product_detail
node_storefront_app -->|"routes to"| node_cart
node_storefront_app -->|"routes to"| node_checkout
node_storefront_app -->|"routes to"| node_payment_verify
node_storefront_app -->|"routes to"| node_customer_orders
node_storefront_app -->|"routes to"| node_customer_login
node_catalog_browse -->|"reads catalog"| node_shop_context
node_product_detail -->|"reads product state"| node_shop_context
node_cart -.->|"uses cart state"| node_shop_context
node_checkout -->|"uses cart state"| node_shop_context
node_shop_context -->|"requests catalog and cart"| node_api
node_checkout -.->|"submits orders"| node_api
node_payment_verify -.->|"verifies payment"| node_api
node_customer_orders -.->|"requests orders"| node_api
node_customer_login -.->|"authenticates"| node_api
node_api -->|"mounts endpoints"| node_user_routes
node_api -->|"mounts endpoints"| node_product_routes
node_api -->|"mounts endpoints"| node_cart_routes
node_api -->|"mounts endpoints"| node_order_routes
node_user_routes -->|"dispatches to"| node_user_controller
node_product_routes -->|"dispatches to"| node_product_controller
node_cart_routes -->|"dispatches to"| node_cart_controller
node_order_routes -->|"dispatches to"| node_order_controller
node_user_controller -->|"reads and writes"| node_users
node_cart_controller -->|"reads and updates cart"| node_users
node_order_controller -->|"creates and updates"| node_orders
node_order_controller -->|"updates cart"| node_users
node_product_controller -->|"reads and writes"| node_products
node_product_controller -->|"uploads images"| node_media_store
node_admin_app -->|"shows when unauthenticated"| node_admin_login
node_admin_app -->|"routes to"| node_product_management
node_admin_app -->|"routes to"| node_product_list
node_admin_app -->|"routes to"| node_order_management
node_admin_login -.->|"authenticates"| node_api
node_product_management -.->|"manages products"| node_api
node_product_list -.->|"requests products"| node_api
node_order_management -.->|"manages orders"| node_api

click node_storefront_app "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/App.jsx"
click node_catalog_browse "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Collection.jsx"
click node_product_detail "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Product.jsx"
click node_shop_context "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/context/ShopContext.jsx"
click node_cart "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Cart.jsx"
click node_checkout "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/PlaceOrder.jsx"
click node_payment_verify "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Verify.jsx"
click node_customer_orders "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Orders.jsx"
click node_customer_login "https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Login.jsx"
click node_api "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/server.js"
click node_user_routes "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/userRoute.js"
click node_product_routes "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/productRoute.js"
click node_cart_routes "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/cartRoute.js"
click node_order_routes "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/orderRoute.js"
click node_user_controller "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/userController.js"
click node_product_controller "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/productController.js"
click node_cart_controller "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/cartController.js"
click node_order_controller "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/orderController.js"
click node_users "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/userModel.js"
click node_products "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/productModel.js"
click node_orders "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/orderModel.js"
click node_media_store "https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/config/cloudinary.js"
click node_admin_app "https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/App.jsx"
click node_admin_login "https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/components/Login.jsx"
click node_product_management "https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/Add.jsx"
click node_product_list "https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/List.jsx"
click node_order_management "https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/Orders.jsx"

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_storefront_app,node_catalog_browse,node_product_detail,node_shop_context,node_cart,node_checkout,node_payment_verify,node_customer_orders,node_customer_login toneBlue
class node_api,node_user_routes,node_product_routes,node_cart_routes,node_order_routes,node_user_controller,node_product_controller,node_cart_controller,node_order_controller toneAmber
class node_admin_app,node_admin_login,node_product_management,node_product_list,node_order_management toneMint
class node_users,node_products,node_orders,node_media_store toneRose
class node_customer toneIndigo
```

## Components

### Customer storefront

- [Storefront routes](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Browse catalog](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Collection.jsx): `Frontend/src/pages/Collection.jsx`
- [Product details](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Product.jsx): `Frontend/src/pages/Product.jsx`
- [Shop state](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/context/ShopContext.jsx): `Frontend/src/context/ShopContext.jsx`
- [Shopping cart](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Cart.jsx): `Frontend/src/pages/Cart.jsx`
- [Checkout](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/PlaceOrder.jsx): `Frontend/src/pages/PlaceOrder.jsx`
- [Payment verification](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Verify.jsx): `Frontend/src/pages/Verify.jsx`
- [Customer orders](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Orders.jsx): `Frontend/src/pages/Orders.jsx`
- [Customer login](https://github.com/utkarshgupta05/e-commerce/blob/master/Frontend/src/pages/Login.jsx): `Frontend/src/pages/Login.jsx`

### Commerce API

- [HTTP API](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/server.js): `Backend/server.js`
- [User endpoints](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/userRoute.js): `Backend/routes/userRoute.js`
- [Product endpoints](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/productRoute.js): `Backend/routes/productRoute.js`
- [Cart endpoints](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/cartRoute.js): `Backend/routes/cartRoute.js`
- [Order endpoints](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/routes/orderRoute.js): `Backend/routes/orderRoute.js`
- [Identity services](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/userController.js): `Backend/controllers/userController.js`
- [Catalog services](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/productController.js): `Backend/controllers/productController.js`
- [Cart services](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/cartController.js): `Backend/controllers/cartController.js`
- [Order and payment](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/controllers/orderController.js): `Backend/controllers/orderController.js`

### Admin console

- [Admin routes](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin login](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/components/Login.jsx): `admin/src/components/Login.jsx`
- [Product management](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/Add.jsx): `admin/src/pages/Add.jsx`
- [Product list](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/List.jsx): `admin/src/pages/List.jsx`
- [Order management](https://github.com/utkarshgupta05/e-commerce/blob/master/admin/src/pages/Orders.jsx): `admin/src/pages/Orders.jsx`

### Persistence and media

- [User records](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/userModel.js): `Backend/models/userModel.js`
- [Product records](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/productModel.js): `Backend/models/productModel.js`
- [Order records](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/models/orderModel.js): `Backend/models/orderModel.js`
- [Image hosting](https://github.com/utkarshgupta05/e-commerce/blob/master/Backend/config/cloudinary.js): `Backend/config/cloudinary.js`

### Other components

- **Customer**

## Connections

- Customer → Storefront routes: uses
- Storefront routes → Browse catalog: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Product details: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Shopping cart: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Checkout: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Payment verification: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Customer orders: routes to (evidence: `Frontend/src/App.jsx`)
- Storefront routes → Customer login: routes to (evidence: `Frontend/src/App.jsx`)
- Browse catalog → Shop state: reads catalog (evidence: `Frontend/src/pages/Collection.jsx`)
- Product details → Shop state: reads product state (evidence: `Frontend/src/pages/Product.jsx`)
- Shopping cart → Shop state: uses cart state
- Checkout → Shop state: uses cart state (evidence: `Frontend/src/pages/PlaceOrder.jsx`)
- Shop state → HTTP API: requests catalog and cart (evidence: `Frontend/src/context/ShopContext.jsx`)
- Checkout → HTTP API: submits orders
- Payment verification → HTTP API: verifies payment
- Customer orders → HTTP API: requests orders
- Customer login → HTTP API: authenticates
- HTTP API → User endpoints: mounts endpoints (evidence: `Backend/server.js`)
- HTTP API → Product endpoints: mounts endpoints (evidence: `Backend/server.js`)
- HTTP API → Cart endpoints: mounts endpoints (evidence: `Backend/server.js`)
- HTTP API → Order endpoints: mounts endpoints (evidence: `Backend/server.js`)
- User endpoints → Identity services: dispatches to (evidence: `Backend/routes/userRoute.js`)
- Product endpoints → Catalog services: dispatches to (evidence: `Backend/routes/productRoute.js`)
- Cart endpoints → Cart services: dispatches to (evidence: `Backend/routes/cartRoute.js`)
- Order endpoints → Order and payment: dispatches to (evidence: `Backend/routes/orderRoute.js`)
- Identity services → User records: reads and writes (evidence: `Backend/controllers/userController.js`)
- Cart services → User records: reads and updates cart (evidence: `Backend/controllers/cartController.js`)
- Order and payment → Order records: creates and updates (evidence: `Backend/controllers/orderController.js`)
- Order and payment → User records: updates cart (evidence: `Backend/controllers/orderController.js`)
- Catalog services → Product records: reads and writes (evidence: `Backend/controllers/productController.js`)
- Catalog services → Image hosting: uploads images (evidence: `Backend/controllers/productController.js`)
- Admin routes → Admin login: shows when unauthenticated (evidence: `admin/src/App.jsx`)
- Admin routes → Product management: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Product list: routes to (evidence: `admin/src/App.jsx`)
- Admin routes → Order management: routes to (evidence: `admin/src/App.jsx`)
- Admin login → HTTP API: authenticates
- Product management → HTTP API: manages products
- Product list → HTTP API: requests products
- Order management → HTTP API: manages orders
