# spandan2106/ecom-platform-2026 architecture

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

- Interactive diagram: https://gitdiagram.com/spandan2106/ecom-platform-2026
- Repository: https://github.com/spandan2106/ecom-platform-2026

## Overview

WE_SELL is a MERN e-commerce application. Shoppers browse and filter a catalog, manage a cart, check out, and track orders; authenticated users also manage profiles, analytics, and a wallet with simulated card operations and user-to-user transfers. The React application provides these experiences over an Express API, whose controllers coordinate MongoDB-backed users, products, and orders. Edges reflect shown imports, route registration, and API calls; some frontend pages and backend controllers were not sampled, so uncertain implementation-level links are omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/App.jsx) (React app routes), [`server/src/controllers/order.controller.js`](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/order.controller.js) (Order logic), [`server/src/controllers/auth.controller.js`](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/auth.controller.js) (Authentication logic), [`server/src/routes/user.routes.js`](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/user.routes.js) (User and wallet routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shopping experience"]
  node_app["React app routes<br/>[App.jsx]"]
  node_catalog["Product catalog<br/>[Shop.jsx]"]
  node_product["Product details<br/>[ProductDetails.jsx]"]
  node_cart["Cart state<br/>[CartContext.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_orders["Order history<br/>[History.jsx]"]
end

subgraph group_account["Account and wallet"]
  node_auth["Auth state<br/>[AuthContext.jsx]"]
  node_profile["Profile and analytics<br/>[Profile.jsx]"]
  node_wallet["Wallet operations<br/>[Wallet.jsx]"]
  node_wallet_history["Wallet history<br/>[WalletHistory.jsx]"]
end

subgraph group_api["Express API"]
  node_server["API application<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_user_routes["User and wallet routes<br/>[user.routes.js]"]
  node_product_routes["Product routes<br/>[product.routes.js]"]
  node_order_routes["Order routes<br/>[order.routes.js]"]
  node_auth_controller["Authentication logic<br/>[auth.controller.js]"]
  node_user_controller["User and wallet logic<br/>[user.controller.js]"]
  node_product_controller["Catalog logic"]
  node_order_controller["Order logic"]
end

subgraph group_domain["Commerce data"]
  node_users[("User records<br/>[User.model.js]")]
  node_products[("Product records<br/>[Product.model.js]")]
  node_order_records[("Order records<br/>[Order.model.js]")]
end

node_shopper(("Shopper"))
node_email["Email service<br/>[sendEmail.js]"]

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_product
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_orders
node_app -->|"provides"| node_auth
node_app -->|"provides"| node_cart
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_wallet
node_app -->|"routes to"| node_wallet_history
node_catalog -.->|"fetches catalog"| node_product_routes
node_wallet -->|"calls wallet API"| node_user_routes
node_auth -->|"fetches profile"| node_user_routes
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_order_routes
node_server -->|"mounts"| node_user_routes
node_auth_routes -->|"routes to"| node_auth_controller
node_user_routes -->|"routes to"| node_user_controller
node_user_routes -->|"routes deletion to"| node_auth_controller
node_product_routes -->|"routes to"| node_product_controller
node_order_routes -->|"routes to"| node_order_controller
node_auth_controller -->|"reads and writes"| node_users
node_auth_controller -->|"deletes user orders"| node_order_records
node_auth_controller -->|"sends reset mail"| node_email
node_user_controller -->|"reads and writes"| node_users
node_user_controller -->|"queries orders"| node_order_records
node_product_controller -.->|"accesses products"| node_products
node_order_controller -->|"creates and queries"| node_order_records
node_order_controller -->|"checks and updates stock"| node_products
node_order_controller -->|"updates cart"| node_users
node_order_controller -->|"sends cancellation mail"| node_email

click node_app "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/App.jsx"
click node_catalog "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Shop.jsx"
click node_product "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/ProductDetails.jsx"
click node_cart "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/context/CartContext.jsx"
click node_checkout "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Checkout.jsx"
click node_orders "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/History.jsx"
click node_auth "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/context/AuthContext.jsx"
click node_profile "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Profile.jsx"
click node_wallet "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Wallet.jsx"
click node_wallet_history "https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/WalletHistory.jsx"
click node_server "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/auth.routes.js"
click node_user_routes "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/user.routes.js"
click node_product_routes "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/product.routes.js"
click node_order_routes "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/order.routes.js"
click node_auth_controller "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/auth.controller.js"
click node_user_controller "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/user.controller.js"
click node_product_controller "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/product.controller.js"
click node_order_controller "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/order.controller.js"
click node_users "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/User.model.js"
click node_products "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/Product.model.js"
click node_order_records "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/Order.model.js"
click node_email "https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/utils/sendEmail.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,node_cart,node_checkout,node_orders toneBlue
class node_auth,node_profile,node_wallet,node_wallet_history toneAmber
class node_server,node_auth_routes,node_user_routes,node_product_routes,node_order_routes,node_auth_controller,node_user_controller,node_product_controller,node_order_controller toneMint
class node_users,node_products,node_order_records toneRose
class node_shopper toneIndigo
class node_email toneTeal
```

## Components

### Shopping experience

- [React app routes](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Product catalog](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Shop.jsx): `client/src/pages/Shop.jsx`
- [Product details](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/ProductDetails.jsx): `client/src/pages/ProductDetails.jsx`
- [Cart state](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/context/CartContext.jsx): `client/src/context/CartContext.jsx`
- [Checkout](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Order history](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/History.jsx): `client/src/pages/History.jsx`

### Account and wallet

- [Auth state](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Profile and analytics](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Wallet operations](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/Wallet.jsx): `client/src/pages/Wallet.jsx`
- [Wallet history](https://github.com/spandan2106/ecom-platform-2026/blob/main/client/src/pages/WalletHistory.jsx): `client/src/pages/WalletHistory.jsx`

### Express API

- [API application](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/app.js): `server/src/app.js`
- [Auth routes](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/auth.routes.js): `server/src/routes/auth.routes.js`
- [User and wallet routes](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/user.routes.js): `server/src/routes/user.routes.js`
- [Product routes](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/product.routes.js): `server/src/routes/product.routes.js`
- [Order routes](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/routes/order.routes.js): `server/src/routes/order.routes.js`
- [Authentication logic](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/auth.controller.js): `server/src/controllers/auth.controller.js`
- [User and wallet logic](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/user.controller.js): `server/src/controllers/user.controller.js`
- [Catalog logic](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/product.controller.js): `server/src/controllers/product.controller.js`
- [Order logic](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/controllers/order.controller.js): `server/src/controllers/order.controller.js`

### Commerce data

- [User records](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/User.model.js): `server/src/models/User.model.js`
- [Product records](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/Product.model.js): `server/src/models/Product.model.js`
- [Order records](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/models/Order.model.js): `server/src/models/Order.model.js`

### Other components

- **Shopper**
- [Email service](https://github.com/spandan2106/ecom-platform-2026/blob/main/server/src/utils/sendEmail.js): `server/src/utils/sendEmail.js`

## Connections

- Shopper → React app routes: uses (evidence: `client/src/App.jsx`)
- React app routes → Product catalog: routes to (evidence: `client/src/App.jsx`)
- React app routes → Product details: routes to (evidence: `client/src/App.jsx`)
- React app routes → Checkout: routes to (evidence: `client/src/App.jsx`)
- React app routes → Order history: routes to (evidence: `client/src/App.jsx`)
- React app routes → Auth state: provides (evidence: `client/src/App.jsx`)
- React app routes → Cart state: provides (evidence: `client/src/App.jsx`)
- React app routes → Profile and analytics: routes to (evidence: `client/src/App.jsx`)
- React app routes → Wallet operations: routes to (evidence: `client/src/App.jsx`)
- React app routes → Wallet history: routes to (evidence: `client/src/App.jsx`)
- Product catalog → Product routes: fetches catalog
- Wallet operations → User and wallet routes: calls wallet API (evidence: `client/src/pages/Wallet.jsx`)
- Auth state → User and wallet routes: fetches profile (evidence: `client/src/context/AuthContext.jsx`)
- API application → Auth routes: mounts (evidence: `server/src/app.js`)
- API application → Product routes: mounts (evidence: `server/src/app.js`)
- API application → Order routes: mounts (evidence: `server/src/app.js`)
- API application → User and wallet routes: mounts (evidence: `server/src/app.js`)
- Auth routes → Authentication logic: routes to (evidence: `server/src/routes/auth.routes.js`)
- User and wallet routes → User and wallet logic: routes to (evidence: `server/src/routes/user.routes.js`)
- User and wallet routes → Authentication logic: routes deletion to (evidence: `server/src/routes/user.routes.js`)
- Product routes → Catalog logic: routes to (evidence: `server/src/routes/product.routes.js`)
- Order routes → Order logic: routes to (evidence: `server/src/routes/order.routes.js`)
- Authentication logic → User records: reads and writes (evidence: `server/src/controllers/auth.controller.js`)
- Authentication logic → Order records: deletes user orders (evidence: `server/src/controllers/auth.controller.js`)
- Authentication logic → Email service: sends reset mail (evidence: `server/src/controllers/auth.controller.js`)
- User and wallet logic → User records: reads and writes (evidence: `server/src/controllers/user.controller.js`)
- User and wallet logic → Order records: queries orders (evidence: `server/src/controllers/user.controller.js`)
- Catalog logic → Product records: accesses products
- Order logic → Order records: creates and queries (evidence: `server/src/controllers/order.controller.js`)
- Order logic → Product records: checks and updates stock (evidence: `server/src/controllers/order.controller.js`)
- Order logic → User records: updates cart (evidence: `server/src/controllers/order.controller.js`)
- Order logic → Email service: sends cancellation mail (evidence: `server/src/controllers/order.controller.js`)
