# bhupendra-jangir/serveflow architecture

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

- Interactive diagram: https://gitdiagram.com/bhupendra-jangir/serveflow
- Repository: https://github.com/bhupendra-jangir/serveflow

## Overview

ServeFlow is a restaurant ordering and operations platform. Customers browse and search the menu, maintain a cart, place orders, and follow order history and status; admins manage menu availability, orders, and dashboard statistics. Angular components use services to call the Express REST API, whose controllers enforce domain rules and persist users, menu items, and orders in MongoDB. Admin status changes also trigger a customer-scoped Socket.IO notification. The graph combines sampled source relationships with documented capabilities; some UI and service internals were not sampled.

Main entry points: [`client/src/app/app-routing-module.ts`](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/app-routing-module.ts) (App routing), [`server/app.js`](https://github.com/bhupendra-jangir/serveflow/blob/main/server/app.js) (Express API), [`client/src/app/services/order.service.ts`](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/order.service.ts) (Order service), [`server/routes/menu.routes.js`](https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/menu.routes.js) (Menu routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular application"]
  node_routing["App routing"]
  node_login["Sign in and register<br/>[login.component.ts]"]
  node_menuui["Browse menu<br/>[menu.component.ts]"]
  node_cartui["Cart and checkout<br/>[cart.component.ts]"]
  node_ordersui["Order history"]
  node_detailui["Order details"]
  node_adminmenuui["Menu management"]
  node_adminordersui["Order management"]
  node_dashboardui["Operations dashboard"]
  node_authsvc["Authentication service<br/>[auth.service.ts]"]
  node_menusvc["Menu service<br/>[menu.service.ts]"]
  node_cartsvc["Cart state<br/>[cart.service.ts]"]
  node_ordersvc["Order service<br/>[order.service.ts]"]
  node_dashsvc["Dashboard service"]
end

subgraph group_api["REST API and access"]
  node_express["Express API<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_menuroutes["Menu routes<br/>[menu.routes.js]"]
  node_orderroutes["Order routes<br/>[order.routes.js]"]
  node_dashroutes["Dashboard routes"]
  node_authctrl["Account operations<br/>[auth.controller.js]"]
  node_menuctrl["Menu operations<br/>[menu.controller.js]"]
  node_orderctrl["Order operations"]
  node_dashctrl["Dashboard statistics"]
  node_authmw["JWT protection<br/>[auth.middleware.js]"]
  node_adminmw["Admin authorization"]
end

subgraph group_domain["Restaurant data"]
  node_userstore[("User records<br/>[User.js]")]
  node_menustore[("Menu records<br/>[MenuItem.js]")]
  node_orderstore[("Order records<br/>[Order.js]")]
end

subgraph group_realtime["Live notifications"]
  node_socketsvc["Socket client<br/>[socket.service.ts]"]
  node_socketserver["Socket.IO server<br/>[socket.js]"]
end

node_customer(("Customer"))
node_admin(("Restaurant admin"))
node_mongodb[("MongoDB")]

node_customer -->|"uses"| node_routing
node_admin -->|"uses"| node_routing
node_routing -->|"routes to"| node_login
node_routing -->|"routes to"| node_menuui
node_routing -->|"routes to"| node_cartui
node_routing -->|"routes to"| node_ordersui
node_routing -->|"routes to"| node_detailui
node_routing -->|"routes to"| node_dashboardui
node_routing -->|"routes to"| node_adminmenuui
node_routing -->|"routes to"| node_adminordersui
node_login -->|"calls"| node_authsvc
node_menuui -->|"calls"| node_menusvc
node_menuui -->|"adds items"| node_cartsvc
node_cartui -->|"updates"| node_cartsvc
node_cartui -->|"places order"| node_ordersvc
node_ordersui -->|"loads history"| node_ordersvc
node_detailui -->|"loads order"| node_ordersvc
node_detailui -.->|"listens"| node_socketsvc
node_adminmenuui -->|"manages menu"| node_menusvc
node_adminordersui -->|"updates status"| node_ordersvc
node_dashboardui -->|"loads stats"| node_dashsvc
node_authsvc -->|"REST requests"| node_express
node_menusvc -->|"REST requests"| node_express
node_ordersvc -->|"REST requests"| node_express
node_dashsvc -->|"REST requests"| node_express
node_express -->|"mounts"| node_authroutes
node_express -->|"mounts"| node_menuroutes
node_express -->|"mounts"| node_orderroutes
node_express -->|"mounts"| node_dashroutes
node_authroutes -->|"dispatches"| node_authctrl
node_menuroutes -->|"dispatches"| node_menuctrl
node_orderroutes -->|"dispatches"| node_orderctrl
node_dashroutes -->|"dispatches"| node_dashctrl
node_menuroutes -->|"protects writes"| node_authmw
node_menuroutes -->|"guards writes"| node_adminmw
node_orderroutes -->|"protects routes"| node_authmw
node_orderroutes -->|"guards status"| node_adminmw
node_authmw -->|"loads user"| node_userstore
node_authctrl -->|"reads and writes"| node_userstore
node_menuctrl -->|"reads and writes"| node_menustore
node_orderctrl -->|"checks items"| node_menustore
node_orderctrl -->|"reads and writes"| node_orderstore
node_dashctrl -->|"queries orders"| node_orderstore
node_socketserver -->|"authenticates clients"| node_userstore
node_orderctrl -->|"emits status"| node_socketserver
node_socketserver -->|"pushes events"| node_socketsvc
node_userstore -->|"persists"| node_mongodb
node_menustore -->|"persists"| node_mongodb

click node_routing "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/app-routing-module.ts"
click node_login "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/login/login.component.ts"
click node_menuui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/menu/menu.component.ts"
click node_cartui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/cart/cart.component.ts"
click node_ordersui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/orders/orders.component.ts"
click node_detailui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/order-details/order-details.component.ts"
click node_adminmenuui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/admin-menu/admin-menu.component.ts"
click node_adminordersui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/admin-orders/admin-orders.component.ts"
click node_dashboardui "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/dashboard/dashboard.component.ts"
click node_authsvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/auth.service.ts"
click node_menusvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/menu.service.ts"
click node_cartsvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/cart.service.ts"
click node_ordersvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/order.service.ts"
click node_dashsvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/dashboard.service.ts"
click node_socketsvc "https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/socket.service.ts"
click node_express "https://github.com/bhupendra-jangir/serveflow/blob/main/server/app.js"
click node_authroutes "https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/auth.routes.js"
click node_menuroutes "https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/menu.routes.js"
click node_orderroutes "https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/order.routes.js"
click node_dashroutes "https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/dashboard.routes.js"
click node_authctrl "https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/auth.controller.js"
click node_menuctrl "https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/menu.controller.js"
click node_orderctrl "https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/order.controller.js"
click node_dashctrl "https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/dashboard.controller.js"
click node_authmw "https://github.com/bhupendra-jangir/serveflow/blob/main/server/middleware/auth.middleware.js"
click node_adminmw "https://github.com/bhupendra-jangir/serveflow/blob/main/server/middleware/admin.middleware.js"
click node_userstore "https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/User.js"
click node_menustore "https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/MenuItem.js"
click node_orderstore "https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/Order.js"
click node_socketserver "https://github.com/bhupendra-jangir/serveflow/blob/main/server/socket/socket.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_routing,node_login,node_menuui,node_cartui,node_ordersui,node_detailui,node_adminmenuui,node_adminordersui,node_dashboardui,node_authsvc,node_menusvc,node_cartsvc,node_ordersvc,node_dashsvc toneBlue
class node_express,node_authroutes,node_menuroutes,node_orderroutes,node_dashroutes,node_authctrl,node_menuctrl,node_orderctrl,node_dashctrl,node_authmw,node_adminmw,node_mongodb toneAmber
class node_userstore,node_menustore,node_orderstore toneMint
class node_socketsvc,node_socketserver toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Angular application

- [App routing](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/app-routing-module.ts): `client/src/app/app-routing-module.ts`
- [Sign in and register](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/login/login.component.ts): `client/src/app/components/login/login.component.ts`
- [Browse menu](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/menu/menu.component.ts): `client/src/app/components/menu/menu.component.ts`
- [Cart and checkout](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/cart/cart.component.ts): `client/src/app/components/cart/cart.component.ts`
- [Order history](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/orders/orders.component.ts): `client/src/app/components/orders/orders.component.ts`
- [Order details](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/order-details/order-details.component.ts): `client/src/app/components/order-details/order-details.component.ts`
- [Menu management](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/admin-menu/admin-menu.component.ts): `client/src/app/components/admin-menu/admin-menu.component.ts`
- [Order management](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/admin-orders/admin-orders.component.ts): `client/src/app/components/admin-orders/admin-orders.component.ts`
- [Operations dashboard](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/components/dashboard/dashboard.component.ts): `client/src/app/components/dashboard/dashboard.component.ts`
- [Authentication service](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/auth.service.ts): `client/src/app/services/auth.service.ts`
- [Menu service](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/menu.service.ts): `client/src/app/services/menu.service.ts`
- [Cart state](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/cart.service.ts): `client/src/app/services/cart.service.ts`
- [Order service](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/order.service.ts): `client/src/app/services/order.service.ts`
- [Dashboard service](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/dashboard.service.ts): `client/src/app/services/dashboard.service.ts`

### REST API and access

- [Express API](https://github.com/bhupendra-jangir/serveflow/blob/main/server/app.js): `server/app.js`
- [Auth routes](https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/auth.routes.js): `server/routes/auth.routes.js`
- [Menu routes](https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/menu.routes.js): `server/routes/menu.routes.js`
- [Order routes](https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/order.routes.js): `server/routes/order.routes.js`
- [Dashboard routes](https://github.com/bhupendra-jangir/serveflow/blob/main/server/routes/dashboard.routes.js): `server/routes/dashboard.routes.js`
- [Account operations](https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/auth.controller.js): `server/controllers/auth.controller.js`
- [Menu operations](https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/menu.controller.js): `server/controllers/menu.controller.js`
- [Order operations](https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/order.controller.js): `server/controllers/order.controller.js`
- [Dashboard statistics](https://github.com/bhupendra-jangir/serveflow/blob/main/server/controllers/dashboard.controller.js): `server/controllers/dashboard.controller.js`
- [JWT protection](https://github.com/bhupendra-jangir/serveflow/blob/main/server/middleware/auth.middleware.js): `server/middleware/auth.middleware.js`
- [Admin authorization](https://github.com/bhupendra-jangir/serveflow/blob/main/server/middleware/admin.middleware.js): `server/middleware/admin.middleware.js`

### Restaurant data

- [User records](https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/User.js): `server/models/User.js`
- [Menu records](https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/MenuItem.js): `server/models/MenuItem.js`
- [Order records](https://github.com/bhupendra-jangir/serveflow/blob/main/server/models/Order.js): `server/models/Order.js`

### Live notifications

- [Socket client](https://github.com/bhupendra-jangir/serveflow/blob/main/client/src/app/services/socket.service.ts): `client/src/app/services/socket.service.ts`
- [Socket.IO server](https://github.com/bhupendra-jangir/serveflow/blob/main/server/socket/socket.js): `server/socket/socket.js`

### Other components

- **Customer**
- **Restaurant admin**
- **MongoDB**

## Connections

- Customer → App routing: uses
- Restaurant admin → App routing: uses
- App routing → Sign in and register: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Browse menu: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Cart and checkout: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Order history: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Order details: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Operations dashboard: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Menu management: routes to (evidence: `client/src/app/app-routing-module.ts`)
- App routing → Order management: routes to (evidence: `client/src/app/app-routing-module.ts`)
- Sign in and register → Authentication service: calls (evidence: `client/src/app/components/login/login.component.ts`)
- Browse menu → Menu service: calls (evidence: `client/src/app/components/menu/menu.component.ts`)
- Browse menu → Cart state: adds items (evidence: `client/src/app/components/menu/menu.component.ts`)
- Cart and checkout → Cart state: updates (evidence: `client/src/app/components/cart/cart.component.ts`)
- Cart and checkout → Order service: places order (evidence: `client/src/app/components/cart/cart.component.ts`)
- Order history → Order service: loads history (evidence: `client/src/app/components/orders/orders.component.ts`)
- Order details → Order service: loads order (evidence: `client/src/app/components/order-details/order-details.component.ts`)
- Order details → Socket client: listens (evidence: `client/src/app/components/order-details/order-details.component.ts`)
- Menu management → Menu service: manages menu (evidence: `client/src/app/components/admin-menu/admin-menu.component.ts`)
- Order management → Order service: updates status (evidence: `client/src/app/components/admin-orders/admin-orders.component.ts`)
- Operations dashboard → Dashboard service: loads stats (evidence: `client/src/app/components/dashboard/dashboard.component.ts`)
- Authentication service → Express API: REST requests
- Menu service → Express API: REST requests
- Order service → Express API: REST requests
- Dashboard service → Express API: REST requests
- Express API → Auth routes: mounts (evidence: `server/app.js`)
- Express API → Menu routes: mounts (evidence: `server/app.js`)
- Express API → Order routes: mounts (evidence: `server/app.js`)
- Express API → Dashboard routes: mounts (evidence: `server/app.js`)
- Auth routes → Account operations: dispatches (evidence: `server/routes/auth.routes.js`)
- Menu routes → Menu operations: dispatches (evidence: `server/routes/menu.routes.js`)
- Order routes → Order operations: dispatches (evidence: `server/routes/order.routes.js`)
- Dashboard routes → Dashboard statistics: dispatches (evidence: `server/routes/dashboard.routes.js`)
- Menu routes → JWT protection: protects writes (evidence: `server/routes/menu.routes.js`)
- Menu routes → Admin authorization: guards writes (evidence: `server/routes/menu.routes.js`)
- Order routes → JWT protection: protects routes (evidence: `server/routes/order.routes.js`)
- Order routes → Admin authorization: guards status (evidence: `server/routes/order.routes.js`)
- JWT protection → User records: loads user (evidence: `server/middleware/auth.middleware.js`)
- Account operations → User records: reads and writes (evidence: `server/controllers/auth.controller.js`)
- Menu operations → Menu records: reads and writes (evidence: `server/controllers/menu.controller.js`)
- Order operations → Menu records: checks items (evidence: `server/controllers/order.controller.js`)
- Order operations → Order records: reads and writes (evidence: `server/controllers/order.controller.js`)
- Dashboard statistics → Order records: queries orders (evidence: `server/controllers/dashboard.controller.js`)
- Socket.IO server → User records: authenticates clients (evidence: `server/socket/socket.js`)
- Order operations → Socket.IO server: emits status (evidence: `server/controllers/order.controller.js`)
- Socket.IO server → Socket client: pushes events
- User records → MongoDB: persists
- Menu records → MongoDB: persists
