# md-suhail07-code/durable-sofa architecture

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

- Interactive diagram: https://gitdiagram.com/md-suhail07-code/durable-sofa
- Repository: https://github.com/md-suhail07-code/durable-sofa

## Overview

Durable Sofa is a furniture e-commerce application. Customers discover products, authenticate, manage a cart and delivery addresses, pay for orders, and review order history; admins manage products, users, orders, and sales. The graph separates the React experience, Express routing and security, domain controllers, persistence, and external services. README documents the broad frontend-to-API workflow and major unsampled capabilities; source-index references and excerpts support the specific backend routing and controller-to-model links shown.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/App.jsx) (React application), [`Backend/server.js`](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/server.js) (Express API server), [`Backend/middleware/isAuthenticated.js`](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/middleware/isAuthenticated.js) (JWT and admin guards), [`Backend/Database/db.js`](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Database/db.js) (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer and admin UI"]
  node_spa["React application<br/>[App.jsx]"]
  node_global_state["Global state"]
  node_identity_ui["Sign-in and verification<br/>[Signup.jsx]"]
  node_catalog_ui["Catalog and product detail<br/>[Products.jsx]"]
  node_cart_ui["Cart and checkout<br/>[Cart.jsx]"]
  node_address_ui["Delivery addresses<br/>[AddressForm.jsx]"]
  node_orders_ui["Order history<br/>[Orders.jsx]"]
  node_profile_ui["Profile management<br/>[Profile.jsx]"]
  node_admin_ui["Admin dashboard"]
end

subgraph group_api["API and security"]
  node_api_server["Express API server<br/>[server.js]"]
  node_auth_routes["Identity routes<br/>[authRoute.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_address_routes["Address routes<br/>[addressRoute.js]"]
  node_order_routes["Order routes<br/>[orderRoute.js]"]
  node_auth_middleware["JWT and admin guards<br/>[isAuthenticated.js]"]
end

subgraph group_domain["Commerce services"]
  node_user_service["Identity and profile<br/>[userController.js]"]
  node_product_service["Catalog management"]
  node_cart_service["Cart management<br/>[cartController.js]"]
  node_address_service["Address management"]
  node_order_service["Order and payment<br/>[orderController.js]"]
end

subgraph group_data["Persistent data"]
  node_mongo[("MongoDB<br/>[db.js]")]
end

subgraph group_integrations["External services"]
  node_email["Email delivery"]
  node_media["Cloudinary media<br/>[cloudinary.js]"]
  node_razorpay["Razorpay<br/>[razorpay.js]"]
  node_google["Google OAuth<br/>[passport.js]"]
end

node_shopper(("Shopper or admin"))

node_shopper -->|"uses"| node_spa
node_spa -->|"manages state"| node_global_state
node_spa -->|"routes to"| node_identity_ui
node_spa -->|"routes to"| node_catalog_ui
node_spa -->|"routes to"| node_cart_ui
node_spa -->|"routes to"| node_address_ui
node_spa -->|"routes to"| node_orders_ui
node_spa -->|"routes to"| node_profile_ui
node_spa -->|"routes to"| node_admin_ui
node_spa -->|"calls API"| node_api_server
node_api_server -->|"connects"| node_mongo
node_api_server -->|"mounts"| node_auth_routes
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_address_routes
node_api_server -->|"mounts"| node_order_routes
node_auth_routes -->|"guards identity"| node_auth_middleware
node_auth_routes -->|"authenticates with"| node_google
node_user_routes -->|"dispatches to"| node_user_service
node_product_routes -->|"dispatches to"| node_product_service
node_cart_routes -->|"dispatches to"| node_cart_service
node_address_routes -->|"dispatches to"| node_address_service
node_order_routes -->|"dispatches to"| node_order_service
node_product_routes -->|"guards routes"| node_auth_middleware
node_user_routes -->|"guards routes"| node_auth_middleware
node_cart_routes -->|"guards routes"| node_auth_middleware
node_address_routes -->|"guards routes"| node_auth_middleware
node_order_routes -->|"guards routes"| node_auth_middleware
node_user_service -->|"reads and writes"| node_mongo
node_product_service -->|"reads and writes"| node_mongo
node_cart_service -->|"reads and writes"| node_mongo
node_address_service -->|"reads and writes"| node_mongo
node_order_service -->|"reads and writes"| node_mongo
node_user_service -->|"sends verification and OTP"| node_email
node_product_service -->|"uploads product images"| node_media
node_user_service -->|"manages profile images"| node_media
node_order_service -->|"creates payment order"| node_razorpay
node_order_service -->|"clears cart"| node_cart_service

click node_spa "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/App.jsx"
click node_global_state "https://github.com/md-suhail07-code/durable-sofa/tree/main/Frontend/src/redux"
click node_identity_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Signup.jsx"
click node_catalog_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Products.jsx"
click node_cart_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Cart.jsx"
click node_address_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/AddressForm.jsx"
click node_orders_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Orders.jsx"
click node_profile_ui "https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Profile.jsx"
click node_admin_ui "https://github.com/md-suhail07-code/durable-sofa/tree/main/Frontend/src/pages/admin"
click node_api_server "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/server.js"
click node_auth_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/authRoute.js"
click node_user_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/userRoute.js"
click node_product_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/productRoute.js"
click node_cart_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/cartRoute.js"
click node_address_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/addressRoute.js"
click node_order_routes "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/orderRoute.js"
click node_auth_middleware "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/middleware/isAuthenticated.js"
click node_user_service "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/userController.js"
click node_product_service "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/productController.js"
click node_cart_service "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/cartController.js"
click node_address_service "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/addressController.js"
click node_order_service "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/orderController.js"
click node_mongo "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Database/db.js"
click node_email "https://github.com/md-suhail07-code/durable-sofa/tree/main/Backend/emailVerify"
click node_media "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/utils/cloudinary.js"
click node_razorpay "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/config/razorpay.js"
click node_google "https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/config/passport.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_spa,node_global_state,node_identity_ui,node_catalog_ui,node_cart_ui,node_address_ui,node_orders_ui,node_profile_ui,node_admin_ui toneBlue
class node_api_server,node_auth_routes,node_user_routes,node_product_routes,node_cart_routes,node_address_routes,node_order_routes,node_auth_middleware toneAmber
class node_user_service,node_product_service,node_cart_service,node_address_service,node_order_service toneMint
class node_mongo toneRose
class node_email,node_media,node_razorpay,node_google,node_shopper toneIndigo
```

## Components

### Customer and admin UI

- [React application](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Global state](https://github.com/md-suhail07-code/durable-sofa/tree/main/Frontend/src/redux): `Frontend/src/redux`
- [Sign-in and verification](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Signup.jsx): `Frontend/src/pages/Signup.jsx`
- [Catalog and product detail](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Products.jsx): `Frontend/src/pages/Products.jsx`
- [Cart and checkout](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Cart.jsx): `Frontend/src/pages/Cart.jsx`
- [Delivery addresses](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/AddressForm.jsx): `Frontend/src/pages/AddressForm.jsx`
- [Order history](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Orders.jsx): `Frontend/src/pages/Orders.jsx`
- [Profile management](https://github.com/md-suhail07-code/durable-sofa/blob/main/Frontend/src/pages/Profile.jsx): `Frontend/src/pages/Profile.jsx`
- [Admin dashboard](https://github.com/md-suhail07-code/durable-sofa/tree/main/Frontend/src/pages/admin): `Frontend/src/pages/admin`

### API and security

- [Express API server](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/server.js): `Backend/server.js`
- [Identity routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/authRoute.js): `Backend/Routes/authRoute.js`
- [User routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/userRoute.js): `Backend/Routes/userRoute.js`
- [Product routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/productRoute.js): `Backend/Routes/productRoute.js`
- [Cart routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/cartRoute.js): `Backend/Routes/cartRoute.js`
- [Address routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/addressRoute.js): `Backend/Routes/addressRoute.js`
- [Order routes](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Routes/orderRoute.js): `Backend/Routes/orderRoute.js`
- [JWT and admin guards](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/middleware/isAuthenticated.js): `Backend/middleware/isAuthenticated.js`

### Commerce services

- [Identity and profile](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/userController.js): `Backend/Controllers/userController.js`
- [Catalog management](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/productController.js): `Backend/Controllers/productController.js`
- [Cart management](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/cartController.js): `Backend/Controllers/cartController.js`
- [Address management](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/addressController.js): `Backend/Controllers/addressController.js`
- [Order and payment](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Controllers/orderController.js): `Backend/Controllers/orderController.js`

### Persistent data

- [MongoDB](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/Database/db.js): `Backend/Database/db.js`

### External services

- [Email delivery](https://github.com/md-suhail07-code/durable-sofa/tree/main/Backend/emailVerify): `Backend/emailVerify`
- [Cloudinary media](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/utils/cloudinary.js): `Backend/utils/cloudinary.js`
- [Razorpay](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/config/razorpay.js): `Backend/config/razorpay.js`
- [Google OAuth](https://github.com/md-suhail07-code/durable-sofa/blob/main/Backend/config/passport.js): `Backend/config/passport.js`

### Other components

- **Shopper or admin**

## Connections

- Shopper or admin → React application: uses
- React application → Global state: manages state (evidence: `Frontend/src/main.jsx`)
- React application → Sign-in and verification: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Catalog and product detail: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Cart and checkout: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Delivery addresses: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Order history: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Profile management: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Admin dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- React application → Express API server: calls API
- Express API server → MongoDB: connects (evidence: `Backend/server.js`)
- Express API server → Identity routes: mounts (evidence: `Backend/server.js`)
- Express API server → User routes: mounts (evidence: `Backend/server.js`)
- Express API server → Product routes: mounts (evidence: `Backend/server.js`)
- Express API server → Cart routes: mounts (evidence: `Backend/server.js`)
- Express API server → Address routes: mounts (evidence: `Backend/server.js`)
- Express API server → Order routes: mounts (evidence: `Backend/server.js`)
- Identity routes → JWT and admin guards: guards identity (evidence: `Backend/Routes/authRoute.js`)
- Identity routes → Google OAuth: authenticates with (evidence: `Backend/Routes/authRoute.js`)
- User routes → Identity and profile: dispatches to (evidence: `Backend/Routes/userRoute.js`)
- Product routes → Catalog management: dispatches to (evidence: `Backend/Routes/productRoute.js`)
- Cart routes → Cart management: dispatches to (evidence: `Backend/Routes/cartRoute.js`)
- Address routes → Address management: dispatches to (evidence: `Backend/Routes/addressRoute.js`)
- Order routes → Order and payment: dispatches to (evidence: `Backend/Routes/orderRoute.js`)
- Product routes → JWT and admin guards: guards routes (evidence: `Backend/Routes/productRoute.js`)
- User routes → JWT and admin guards: guards routes (evidence: `Backend/Routes/userRoute.js`)
- Cart routes → JWT and admin guards: guards routes (evidence: `Backend/Routes/cartRoute.js`)
- Address routes → JWT and admin guards: guards routes (evidence: `Backend/Routes/addressRoute.js`)
- Order routes → JWT and admin guards: guards routes (evidence: `Backend/Routes/orderRoute.js`)
- Identity and profile → MongoDB: reads and writes (evidence: `Backend/Controllers/userController.js`)
- Catalog management → MongoDB: reads and writes (evidence: `Backend/Controllers/productController.js`)
- Cart management → MongoDB: reads and writes (evidence: `Backend/Controllers/cartController.js`)
- Address management → MongoDB: reads and writes (evidence: `Backend/Controllers/addressController.js`)
- Order and payment → MongoDB: reads and writes (evidence: `Backend/Controllers/orderController.js`)
- Identity and profile → Email delivery: sends verification and OTP (evidence: `Backend/Controllers/userController.js`)
- Catalog management → Cloudinary media: uploads product images (evidence: `Backend/Controllers/productController.js`)
- Identity and profile → Cloudinary media: manages profile images (evidence: `Backend/Controllers/userController.js`)
- Order and payment → Razorpay: creates payment order (evidence: `Backend/Controllers/orderController.js`)
- Order and payment → Cart management: clears cart (evidence: `Backend/Controllers/orderController.js`)
