# excorsite/digitalmandu_platform architecture

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

- Interactive diagram: https://gitdiagram.com/excorsite/digitalmandu_platform
- Repository: https://github.com/excorsite/digitalmandu_platform

## Overview

DigitalMandu is a food-ordering and eCommerce platform. Buyers browse products, manage a cart, check out with cash-on-delivery or Khalti, and track orders; sellers and admins manage products and orders, while admins also manage users. The frontend routes users to role-specific pages and its API layer communicates with the Express backend, whose controllers operate on MongoDB models. The README documents reviews, recommendations, OTP-based auth, and a Socket.IO scaffold. Some page and controller connections are supported by the source index rather than inspected excerpts; uncertain runtime links are omitted.

Main entry points: [`Backend/app.js`](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/app.js) (Express app), [`Backend/models`](https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/models) (Mongoose models), [`Backend/routes/user`](https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/routes/user) (Buyer routes), [`Frontend/src/routes.jsx`](https://github.com/excorsite/digitalmandu_platform/blob/main/Frontend/src/routes.jsx) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_routes["App routes<br/>[routes.jsx]"]
  node_buyer_pages["Buyer pages"]
  node_seller_pages["Seller pages"]
  node_admin_pages["Admin pages"]
  node_payment_pages["Payment pages"]
  node_frontend_api["API client"]
end

subgraph group_api["API and access"]
  node_express["Express app<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[authRoute.js]"]
  node_product_routes["Product routes<br/>[productRoute.js]"]
  node_user_routes["Buyer routes"]
  node_admin_routes["Admin routes"]
  node_recommend_routes["Recommendation route"]
end

subgraph group_commerce["Commerce services"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_product_controller["Product catalog"]
  node_cart_controller["Cart<br/>[cartController.js]"]
  node_order_controller["Orders<br/>[orderController.js]"]
  node_payment_controller["Payments"]
  node_review_controller["Reviews"]
  node_recommend_controller["Recommendations"]
  node_user_controller["User profiles"]
  node_admin_order_controller["Order administration"]
  node_admin_user_controller["User administration<br/>[userController.js]"]
end

subgraph group_data["Data and integrations"]
  node_models[("Mongoose models")]
  node_database["MongoDB connection<br/>[database.js]"]
  node_recommend_service["Recommendation logic"]
  node_email["Email delivery<br/>[sendEmail.js]"]
end

node_shopper(("Buyer"))
node_staff(("Seller / admin"))
node_khalti["Khalti"]
node_mongodb[("MongoDB")]

node_shopper -->|"uses"| node_routes
node_staff -->|"uses"| node_routes
node_routes -->|"routes to"| node_buyer_pages
node_routes -->|"routes to"| node_seller_pages
node_routes -->|"routes to"| node_admin_pages
node_routes -->|"routes to"| node_payment_pages
node_buyer_pages -.->|"requests data"| node_frontend_api
node_seller_pages -.->|"requests data"| node_frontend_api
node_admin_pages -.->|"requests data"| node_frontend_api
node_payment_pages -.->|"requests data"| node_frontend_api
node_frontend_api -->|"calls API"| node_express
node_express -->|"mounts"| node_auth_routes
node_express -->|"mounts"| node_product_routes
node_express -->|"mounts"| node_user_routes
node_express -->|"mounts"| node_admin_routes
node_express -->|"mounts"| node_recommend_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_product_routes -->|"dispatches"| node_product_controller
node_user_routes -->|"dispatches"| node_cart_controller
node_user_routes -->|"dispatches"| node_order_controller
node_user_routes -->|"dispatches"| node_payment_controller
node_user_routes -->|"dispatches"| node_review_controller
node_user_routes -->|"dispatches"| node_user_controller
node_admin_routes -->|"dispatches"| node_admin_order_controller
node_admin_routes -->|"dispatches"| node_admin_user_controller
node_auth_controller -->|"reads and writes"| node_models
node_product_controller -->|"reads and writes"| node_models
node_cart_controller -->|"reads and writes"| node_models
node_order_controller -->|"reads and writes"| node_models
node_payment_controller -->|"reads and writes"| node_models
node_review_controller -->|"reads and writes"| node_models
node_recommend_controller -->|"requests recommendations"| node_recommend_service
node_recommend_controller -->|"queries products"| node_models
node_recommend_service -->|"reads orders"| node_models
node_auth_controller -->|"sends OTP"| node_email
node_payment_controller -.->|"initiates payment"| node_khalti
node_express -->|"connects database"| node_database
node_database -.->|"connects to"| node_mongodb

click node_routes "https://github.com/excorsite/digitalmandu_platform/blob/main/Frontend/src/routes.jsx"
click node_buyer_pages "https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/buyer"
click node_seller_pages "https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/seller"
click node_admin_pages "https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/admin"
click node_payment_pages "https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/payment"
click node_frontend_api "https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/api"
click node_express "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/app.js"
click node_auth_routes "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/auth/authRoute.js"
click node_product_routes "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/admin/productRoute.js"
click node_user_routes "https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/routes/user"
click node_admin_routes "https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/routes/admin"
click node_recommend_routes "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/recommendation/recommendationRoute.js"
click node_auth_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/auth/authController.js"
click node_product_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/product/productController.js"
click node_cart_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/cart/cartController.js"
click node_order_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/order/orderController.js"
click node_payment_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/payment/paymentController.js"
click node_review_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/review/reviewController.js"
click node_recommend_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/recommendation/recommendationController.js"
click node_user_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/customization/customizationController.js"
click node_admin_order_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/order/adminOrderController.js"
click node_admin_user_controller "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/users/userController.js"
click node_models "https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/models"
click node_database "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/database/database.js"
click node_recommend_service "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/services/recommendationService.js"
click node_email "https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/services/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_routes,node_buyer_pages,node_seller_pages,node_admin_pages,node_payment_pages,node_frontend_api toneBlue
class node_express,node_auth_routes,node_product_routes,node_user_routes,node_admin_routes,node_recommend_routes,node_mongodb toneAmber
class node_auth_controller,node_product_controller,node_cart_controller,node_order_controller,node_payment_controller,node_review_controller,node_recommend_controller,node_user_controller,node_admin_order_controller,node_admin_user_controller toneMint
class node_models,node_database,node_recommend_service,node_email toneRose
class node_shopper,node_staff,node_khalti toneIndigo
```

## Components

### Frontend

- [App routes](https://github.com/excorsite/digitalmandu_platform/blob/main/Frontend/src/routes.jsx): `Frontend/src/routes.jsx`
- [Buyer pages](https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/buyer): `Frontend/src/pages/buyer`
- [Seller pages](https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/seller): `Frontend/src/pages/seller`
- [Admin pages](https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/admin): `Frontend/src/pages/admin`
- [Payment pages](https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/pages/payment): `Frontend/src/pages/payment`
- [API client](https://github.com/excorsite/digitalmandu_platform/tree/main/Frontend/src/api): `Frontend/src/api`

### API and access

- [Express app](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/app.js): `Backend/app.js`
- [Auth routes](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/auth/authRoute.js): `Backend/routes/auth/authRoute.js`
- [Product routes](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/admin/productRoute.js): `Backend/routes/admin/productRoute.js`
- [Buyer routes](https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/routes/user): `Backend/routes/user`
- [Admin routes](https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/routes/admin): `Backend/routes/admin`
- [Recommendation route](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/routes/recommendation/recommendationRoute.js): `Backend/routes/recommendation/recommendationRoute.js`

### Commerce services

- [Authentication](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/auth/authController.js): `Backend/controller/auth/authController.js`
- [Product catalog](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/product/productController.js): `Backend/controller/admin/product/productController.js`
- [Cart](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/cart/cartController.js): `Backend/controller/user/cart/cartController.js`
- [Orders](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/order/orderController.js): `Backend/controller/user/order/orderController.js`
- [Payments](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/payment/paymentController.js): `Backend/controller/user/payment/paymentController.js`
- [Reviews](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/review/reviewController.js): `Backend/controller/user/review/reviewController.js`
- [Recommendations](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/recommendation/recommendationController.js): `Backend/controller/recommendation/recommendationController.js`
- [User profiles](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/user/customization/customizationController.js): `Backend/controller/user/customization/customizationController.js`
- [Order administration](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/order/adminOrderController.js): `Backend/controller/admin/order/adminOrderController.js`
- [User administration](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/controller/admin/users/userController.js): `Backend/controller/admin/users/userController.js`

### Data and integrations

- [Mongoose models](https://github.com/excorsite/digitalmandu_platform/tree/main/Backend/models): `Backend/models`
- [MongoDB connection](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/database/database.js): `Backend/database/database.js`
- [Recommendation logic](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/services/recommendationService.js): `Backend/services/recommendationService.js`
- [Email delivery](https://github.com/excorsite/digitalmandu_platform/blob/main/Backend/services/sendEmail.js): `Backend/services/sendEmail.js`

### Other components

- **Buyer**
- **Seller / admin**
- **Khalti**
- **MongoDB**

## Connections

- Buyer → App routes: uses (evidence: `README.md`)
- Seller / admin → App routes: uses (evidence: `README.md`)
- App routes → Buyer pages: routes to (evidence: `Frontend/src/routes.jsx`)
- App routes → Seller pages: routes to (evidence: `Frontend/src/routes.jsx`)
- App routes → Admin pages: routes to (evidence: `Frontend/src/routes.jsx`)
- App routes → Payment pages: routes to (evidence: `Frontend/src/routes.jsx`)
- Buyer pages → API client: requests data
- Seller pages → API client: requests data
- Admin pages → API client: requests data
- Payment pages → API client: requests data
- API client → Express app: calls API (evidence: `README.md`)
- Express app → Auth routes: mounts (evidence: `Backend/app.js`)
- Express app → Product routes: mounts (evidence: `Backend/app.js`)
- Express app → Buyer routes: mounts (evidence: `Backend/app.js`)
- Express app → Admin routes: mounts (evidence: `Backend/app.js`)
- Express app → Recommendation route: mounts (evidence: `Backend/app.js`)
- Auth routes → Authentication: dispatches (evidence: `Backend/routes/auth/authRoute.js`)
- Product routes → Product catalog: dispatches (evidence: `Backend/routes/admin/productRoute.js`)
- Buyer routes → Cart: dispatches (evidence: `Backend/routes/user/cartRoute.js`)
- Buyer routes → Orders: dispatches (evidence: `Backend/routes/user/orderRoute.js`)
- Buyer routes → Payments: dispatches (evidence: `Backend/routes/user/paymentRoute.js`)
- Buyer routes → Reviews: dispatches (evidence: `Backend/routes/user/userReviewRoute.js`)
- Buyer routes → User profiles: dispatches (evidence: `Backend/routes/user/profileRoute.js`)
- Admin routes → Order administration: dispatches (evidence: `Backend/routes/admin/adminOrderRoute.js`)
- Admin routes → User administration: dispatches (evidence: `Backend/routes/admin/adminUserRoute.js`)
- Authentication → Mongoose models: reads and writes (evidence: `Backend/controller/auth/authController.js`)
- Product catalog → Mongoose models: reads and writes (evidence: `Backend/controller/admin/product/productController.js`)
- Cart → Mongoose models: reads and writes (evidence: `Backend/controller/user/cart/cartController.js`)
- Orders → Mongoose models: reads and writes (evidence: `Backend/controller/user/order/orderController.js`)
- Payments → Mongoose models: reads and writes (evidence: `Backend/controller/user/payment/paymentController.js`)
- Reviews → Mongoose models: reads and writes (evidence: `Backend/controller/user/review/reviewController.js`)
- Recommendations → Recommendation logic: requests recommendations (evidence: `Backend/controller/recommendation/recommendationController.js`)
- Recommendations → Mongoose models: queries products (evidence: `Backend/controller/recommendation/recommendationController.js`)
- Recommendation logic → Mongoose models: reads orders (evidence: `Backend/services/recommendationService.js`)
- Authentication → Email delivery: sends OTP (evidence: `Backend/controller/auth/authController.js`)
- Payments → Khalti: initiates payment
- Express app → MongoDB connection: connects database (evidence: `Backend/app.js`)
- MongoDB connection → MongoDB: connects to
