# shraddhas007/ecom architecture

> Architecture diagram of the GitHub repository shraddhas007/ecom, 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/shraddhas007/ecom
- Repository: https://github.com/shraddhas007/ecom

## Overview

This is a women’s fashion e-commerce application with a customer storefront, an Express/MongoDB API, and a separate admin panel. The main customer flow is browsing category collections, managing a cart, placing an order, and completing payment; administrators manage products and orders. The graph also preserves account and password-reset flows, product image uploads, and catalog merchandising. Several page-to-API links are documented or visible in the sampled context; unsampled admin API wiring is left unasserted.

Main entry points: [`backend/controllers/orderController.js`](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/orderController.js) (Order processing), [`backend/controllers/productController.js`](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/productController.js) (Product catalog), [`backend/server.js`](https://github.com/shraddhas007/ecom/blob/main/backend/server.js) (API server), [`frontend/src/App.jsx`](https://github.com/shraddhas007/ecom/blob/main/frontend/src/App.jsx) (Storefront router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_storefront_app["Storefront router<br/>[App.jsx]"]
  node_shop_context["Shop context<br/>[ShopContext.jsx]"]
  node_home["Home and merchandising<br/>[Home.jsx]"]
  node_category_pages["Category collections"]
  node_product_page["Product detail<br/>[Product.jsx]"]
end

subgraph group_commerce["Cart and checkout"]
  node_cart_page["Cart<br/>[Cart.jsx]"]
  node_place_order["Place order<br/>[PlaceOrder.jsx]"]
  node_verify_page["Payment verification<br/>[Verify.jsx]"]
  node_orders_page["Customer orders<br/>[Orders.jsx]"]
end

subgraph group_identity["Accounts and access"]
  node_login_page["Customer login<br/>[Login.jsx]"]
end

subgraph group_backend["Backend services"]
  node_catalog_controller["Product catalog"]
  node_product_model["Product records<br/>[productModel.js]"]
  node_cart_controller["Cart operations<br/>[cartController.js]"]
  node_order_controller["Order processing<br/>[orderController.js]"]
  node_order_model["Order records<br/>[orderModel.js]"]
  node_user_controller["User and admin auth<br/>[userController.js]"]
  node_user_model["User and cart data<br/>[userModel.js]"]
  node_api_server["API server<br/>[server.js]"]
  node_user_routes["User routes<br/>[userRoute.js]"]
  node_product_routes["Product routes<br/>[productRoute.js]"]
  node_cart_routes["Cart routes<br/>[cartRoute.js]"]
  node_order_routes["Order routes<br/>[orderRoute.js]"]
  node_mongodb[("MongoDB connection<br/>[mongodb.js]")]
end

subgraph group_admin["Admin operations"]
  node_admin_app["Admin application<br/>[App.jsx]"]
  node_admin_login["Admin login<br/>[Login.jsx]"]
  node_admin_add["Add products<br/>[Add.jsx]"]
  node_admin_list["Product list<br/>[List.jsx]"]
  node_admin_orders["Order management<br/>[Orders.jsx]"]
end

node_customer(("Customer"))
node_stripe["Stripe"]
node_email["Email service"]
node_cloudinary["Cloudinary"]
node_administrator(("Administrator"))

node_customer -->|"uses"| node_storefront_app
node_storefront_app -->|"routes to"| node_home
node_storefront_app -->|"routes to"| node_category_pages
node_storefront_app -->|"routes to"| node_product_page
node_storefront_app -->|"provides"| node_shop_context
node_shop_context -->|"requests catalog"| node_catalog_controller
node_catalog_controller -->|"queries"| node_product_model
node_shop_context -->|"requests cart"| node_cart_controller
node_cart_controller -->|"reads and updates"| node_user_model
node_cart_controller -->|"loads item details"| node_product_model
node_cart_page -->|"uses"| node_shop_context
node_place_order -.->|"submits order"| node_order_controller
node_order_controller -->|"creates and queries"| node_order_model
node_order_controller -->|"updates cart"| node_user_model
node_order_controller -->|"loads order items"| node_product_model
node_order_controller -->|"creates checkout"| node_stripe
node_verify_page -.->|"verifies payment"| node_order_controller
node_orders_page -.->|"requests orders"| node_order_controller
node_login_page -.->|"authenticates"| node_user_controller
node_user_controller -->|"reads and saves"| node_user_model
node_user_controller -->|"sends reset OTP"| node_email
node_api_server -->|"mounts"| node_user_routes
node_api_server -->|"mounts"| node_product_routes
node_api_server -->|"mounts"| node_cart_routes
node_api_server -->|"mounts"| node_order_routes
node_user_routes -->|"dispatches to"| node_user_controller
node_product_routes -->|"dispatches to"| node_catalog_controller
node_cart_routes -->|"dispatches to"| node_cart_controller
node_order_routes -->|"dispatches to"| node_order_controller
node_api_server -->|"connects"| node_mongodb
node_catalog_controller -->|"uploads images"| node_cloudinary
node_administrator -->|"uses"| node_admin_app
node_admin_app -->|"renders when logged out"| node_admin_login
node_admin_app -->|"routes to"| node_admin_add
node_admin_app -->|"routes to"| node_admin_list
node_admin_app -->|"routes to"| node_admin_orders
node_admin_add -.->|"manages products"| node_catalog_controller
node_admin_list -.->|"manages products"| node_catalog_controller
node_admin_orders -.->|"manages orders"| node_order_controller

click node_storefront_app "https://github.com/shraddhas007/ecom/blob/main/frontend/src/App.jsx"
click node_shop_context "https://github.com/shraddhas007/ecom/blob/main/frontend/src/context/ShopContext.jsx"
click node_home "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Home.jsx"
click node_category_pages "https://github.com/shraddhas007/ecom/tree/main/frontend/src/pages"
click node_product_page "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Product.jsx"
click node_catalog_controller "https://github.com/shraddhas007/ecom/blob/main/backend/controllers/productController.js"
click node_product_model "https://github.com/shraddhas007/ecom/blob/main/backend/models/productModel.js"
click node_cart_page "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Cart.jsx"
click node_place_order "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/PlaceOrder.jsx"
click node_verify_page "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Verify.jsx"
click node_orders_page "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Orders.jsx"
click node_cart_controller "https://github.com/shraddhas007/ecom/blob/main/backend/controllers/cartController.js"
click node_order_controller "https://github.com/shraddhas007/ecom/blob/main/backend/controllers/orderController.js"
click node_order_model "https://github.com/shraddhas007/ecom/blob/main/backend/models/orderModel.js"
click node_login_page "https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Login.jsx"
click node_user_controller "https://github.com/shraddhas007/ecom/blob/main/backend/controllers/userController.js"
click node_user_model "https://github.com/shraddhas007/ecom/blob/main/backend/models/userModel.js"
click node_api_server "https://github.com/shraddhas007/ecom/blob/main/backend/server.js"
click node_user_routes "https://github.com/shraddhas007/ecom/blob/main/backend/routes/userRoute.js"
click node_product_routes "https://github.com/shraddhas007/ecom/blob/main/backend/routes/productRoute.js"
click node_cart_routes "https://github.com/shraddhas007/ecom/blob/main/backend/routes/cartRoute.js"
click node_order_routes "https://github.com/shraddhas007/ecom/blob/main/backend/routes/orderRoute.js"
click node_mongodb "https://github.com/shraddhas007/ecom/blob/main/backend/config/mongodb.js"
click node_admin_app "https://github.com/shraddhas007/ecom/blob/main/admin/src/App.jsx"
click node_admin_login "https://github.com/shraddhas007/ecom/blob/main/admin/src/components/Login.jsx"
click node_admin_add "https://github.com/shraddhas007/ecom/blob/main/admin/src/pages/Add.jsx"
click node_admin_list "https://github.com/shraddhas007/ecom/blob/main/admin/src/pages/List.jsx"
click node_admin_orders "https://github.com/shraddhas007/ecom/blob/main/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_shop_context,node_home,node_category_pages,node_product_page toneBlue
class node_cart_page,node_place_order,node_verify_page,node_orders_page toneAmber
class node_login_page toneMint
class node_catalog_controller,node_product_model,node_cart_controller,node_order_controller,node_order_model,node_user_controller,node_user_model,node_api_server,node_user_routes,node_product_routes,node_cart_routes,node_order_routes,node_mongodb toneRose
class node_admin_app,node_admin_login,node_admin_add,node_admin_list,node_admin_orders,node_customer,node_stripe,node_email,node_cloudinary,node_administrator toneIndigo
```

## Components

### Customer storefront

- [Storefront router](https://github.com/shraddhas007/ecom/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Shop context](https://github.com/shraddhas007/ecom/blob/main/frontend/src/context/ShopContext.jsx): `frontend/src/context/ShopContext.jsx`
- [Home and merchandising](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Category collections](https://github.com/shraddhas007/ecom/tree/main/frontend/src/pages): `frontend/src/pages`
- [Product detail](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Product.jsx): `frontend/src/pages/Product.jsx`

### Cart and checkout

- [Cart](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Cart.jsx): `frontend/src/pages/Cart.jsx`
- [Place order](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/PlaceOrder.jsx): `frontend/src/pages/PlaceOrder.jsx`
- [Payment verification](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Verify.jsx): `frontend/src/pages/Verify.jsx`
- [Customer orders](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`

### Accounts and access

- [Customer login](https://github.com/shraddhas007/ecom/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`

### Backend services

- [Product catalog](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product records](https://github.com/shraddhas007/ecom/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [Cart operations](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/cartController.js): `backend/controllers/cartController.js`
- [Order processing](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Order records](https://github.com/shraddhas007/ecom/blob/main/backend/models/orderModel.js): `backend/models/orderModel.js`
- [User and admin auth](https://github.com/shraddhas007/ecom/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [User and cart data](https://github.com/shraddhas007/ecom/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [API server](https://github.com/shraddhas007/ecom/blob/main/backend/server.js): `backend/server.js`
- [User routes](https://github.com/shraddhas007/ecom/blob/main/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Product routes](https://github.com/shraddhas007/ecom/blob/main/backend/routes/productRoute.js): `backend/routes/productRoute.js`
- [Cart routes](https://github.com/shraddhas007/ecom/blob/main/backend/routes/cartRoute.js): `backend/routes/cartRoute.js`
- [Order routes](https://github.com/shraddhas007/ecom/blob/main/backend/routes/orderRoute.js): `backend/routes/orderRoute.js`
- [MongoDB connection](https://github.com/shraddhas007/ecom/blob/main/backend/config/mongodb.js): `backend/config/mongodb.js`

### Admin operations

- [Admin application](https://github.com/shraddhas007/ecom/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin login](https://github.com/shraddhas007/ecom/blob/main/admin/src/components/Login.jsx): `admin/src/components/Login.jsx`
- [Add products](https://github.com/shraddhas007/ecom/blob/main/admin/src/pages/Add.jsx): `admin/src/pages/Add.jsx`
- [Product list](https://github.com/shraddhas007/ecom/blob/main/admin/src/pages/List.jsx): `admin/src/pages/List.jsx`
- [Order management](https://github.com/shraddhas007/ecom/blob/main/admin/src/pages/Orders.jsx): `admin/src/pages/Orders.jsx`

### Other components

- **Customer**
- **Stripe**
- **Email service**
- **Cloudinary**
- **Administrator**

## Connections

- Customer → Storefront router: uses
- Storefront router → Home and merchandising: routes to (evidence: `frontend/src/App.jsx`)
- Storefront router → Category collections: routes to (evidence: `frontend/src/App.jsx`)
- Storefront router → Product detail: routes to (evidence: `frontend/src/App.jsx`)
- Storefront router → Shop context: provides (evidence: `frontend/src/App.jsx`)
- Shop context → Product catalog: requests catalog (evidence: `frontend/src/context/ShopContext.jsx`)
- Product catalog → Product records: queries (evidence: `backend/controllers/productController.js`)
- Shop context → Cart operations: requests cart (evidence: `frontend/src/context/ShopContext.jsx`)
- Cart operations → User and cart data: reads and updates (evidence: `backend/controllers/cartController.js`)
- Cart operations → Product records: loads item details (evidence: `backend/controllers/cartController.js`)
- Cart → Shop context: uses (evidence: `frontend/src/pages/Cart.jsx`)
- Place order → Order processing: submits order
- Order processing → Order records: creates and queries (evidence: `backend/controllers/orderController.js`)
- Order processing → User and cart data: updates cart (evidence: `backend/controllers/orderController.js`)
- Order processing → Product records: loads order items (evidence: `backend/controllers/orderController.js`)
- Order processing → Stripe: creates checkout (evidence: `backend/controllers/orderController.js`)
- Payment verification → Order processing: verifies payment
- Customer orders → Order processing: requests orders
- Customer login → User and admin auth: authenticates
- User and admin auth → User and cart data: reads and saves (evidence: `backend/controllers/userController.js`)
- User and admin auth → Email service: sends reset OTP (evidence: `backend/controllers/userController.js`)
- API server → User routes: mounts (evidence: `backend/server.js`)
- API server → Product routes: mounts (evidence: `backend/server.js`)
- API server → Cart routes: mounts (evidence: `backend/server.js`)
- API server → Order routes: mounts (evidence: `backend/server.js`)
- User routes → User and admin auth: dispatches to (evidence: `backend/routes/userRoute.js`)
- Product routes → Product catalog: dispatches to (evidence: `backend/routes/productRoute.js`)
- Cart routes → Cart operations: dispatches to (evidence: `backend/routes/cartRoute.js`)
- Order routes → Order processing: dispatches to (evidence: `backend/routes/orderRoute.js`)
- API server → MongoDB connection: connects (evidence: `backend/server.js`)
- Product catalog → Cloudinary: uploads images (evidence: `backend/controllers/productController.js`)
- Administrator → Admin application: uses
- Admin application → Admin login: renders when logged out (evidence: `admin/src/App.jsx`)
- Admin application → Add products: routes to (evidence: `admin/src/App.jsx`)
- Admin application → Product list: routes to (evidence: `admin/src/App.jsx`)
- Admin application → Order management: routes to (evidence: `admin/src/App.jsx`)
- Add products → Product catalog: manages products
- Product list → Product catalog: manages products
- Order management → Order processing: manages orders
