# sfe7/foodexpress-mean-stack architecture

> Architecture diagram of the GitHub repository sfe7/foodexpress-mean-stack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sfe7/foodexpress-mean-stack
- Repository: https://github.com/sfe7/foodexpress-mean-stack

## Overview

FoodExpress is a MEAN food-ordering and restaurant-management platform. Clients browse restaurants and menus, add dishes to a cart, check out with server-validated pricing, and follow orders; restaurateurs manage menus, orders, and KPIs, while admins manage users, restaurant validation, categories, and platform statistics. The backend route/controller/model layers and Angular page/service layers provide the main internal structure. Evidence is limited to the supplied excerpts, SOURCE INDEX references, and README; some unsampled page and service details are therefore represented at subsystem level.

Main entry points: [`frontend/src/app/core/services/restaurant.service.ts`](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/restaurant.service.ts) (Restaurant service), [`backend/server.js`](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/server.js) (Express API server), [`backend/controllers/restaurantController.js`](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/restaurantController.js) (Restaurant controller), [`backend/controllers/orderController.js`](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/orderController.js) (Order controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer experience"]
  node_browse["Restaurant browsing"]
  node_details["Restaurant details"]
  node_cart["Cart<br/>[cart.service.ts]"]
  node_checkout["Checkout"]
  node_ordersview["Order tracking"]
  node_home["Home and entry pages<br/>[home.component.ts]"]
  node_authpages["Login and registration<br/>[login.component.ts]"]
end

subgraph group_portal["Management portals"]
  node_restportal["Restaurant operations"]
  node_dishpage["Dish management"]
  node_orderpage["Incoming orders"]
  node_adminpages["Admin operations"]
  node_statistics["Admin statistics"]
end

subgraph group_frontcore["Angular core"]
  node_authsvc["Authentication service<br/>[auth.service.ts]"]
  node_restaurantsvc["Restaurant service"]
  node_catalogsvc["Menu services"]
  node_ordersvc["Order service<br/>[order.service.ts]"]
  node_dashboard_svc["Dashboard service"]
end

subgraph group_api["API and domain"]
  node_server["Express API server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_catalogroutes["Restaurant and menu routes"]
  node_orderroutes["Order routes<br/>[orderRoutes.js]"]
  node_dashroutes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_authctrl["Authentication controller<br/>[authController.js]"]
  node_restctrl["Restaurant controller"]
  node_orderctrl["Order controller<br/>[orderController.js]"]
  node_dashctrl["Dashboard controller"]
  node_access["Access middleware<br/>[authMiddleware.js]"]
end

subgraph group_data["Persistence"]
  node_userstore[("User records<br/>[User.js]")]
  node_reststore[("Restaurant records<br/>[Restaurant.js]")]
  node_menustore[("Menu records<br/>[Category.js]")]
  node_dishstore[("Dish records<br/>[Dish.js]")]
  node_orderstore[("Order records<br/>[Order.js]")]
end

node_visitor(("Visitor or user"))
node_mongo[("MongoDB")]

node_visitor -->|"browses"| node_browse
node_visitor -->|"signs in"| node_authpages
node_browse -->|"requests listings"| node_restaurantsvc
node_details -->|"requests details"| node_restaurantsvc
node_details -->|"loads menu"| node_catalogsvc
node_details -->|"adds dishes"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"submits order"| node_ordersvc
node_ordersview -->|"loads orders"| node_ordersvc
node_authpages -->|"authenticates"| node_authsvc
node_restportal -->|"selects restaurants"| node_restaurantsvc
node_dishpage -->|"manages menu"| node_catalogsvc
node_orderpage -->|"manages orders"| node_ordersvc
node_adminpages -->|"reviews restaurants"| node_restaurantsvc
node_statistics -.->|"loads KPIs"| node_dashboard_svc
node_authsvc -->|"calls auth API"| node_authroutes
node_restaurantsvc -->|"calls restaurant API"| node_catalogroutes
node_ordersvc -->|"calls order API"| node_orderroutes
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_catalogroutes
node_server -->|"mounts"| node_orderroutes
node_server -->|"mounts"| node_dashroutes
node_authroutes -->|"routes requests"| node_authctrl
node_catalogroutes -->|"routes restaurant requests"| node_restctrl
node_orderroutes -->|"routes order requests"| node_orderctrl
node_dashroutes -->|"routes dashboard requests"| node_dashctrl
node_authroutes -->|"protects routes"| node_access
node_orderroutes -->|"protects routes"| node_access
node_authctrl -->|"reads and writes"| node_userstore
node_access -->|"loads identity"| node_userstore
node_restctrl -->|"reads and writes"| node_reststore
node_restctrl -->|"deletes dishes"| node_dishstore
node_restctrl -->|"deletes categories"| node_menustore
node_orderctrl -->|"creates and updates"| node_orderstore
node_orderctrl -->|"validates prices"| node_dishstore
node_orderctrl -->|"checks restaurant"| node_reststore
node_dashctrl -->|"aggregates KPIs"| node_orderstore
node_dashctrl -->|"counts restaurants"| node_reststore
node_dashctrl -->|"counts users"| node_userstore
node_userstore -.->|"persists"| node_mongo
node_reststore -.->|"persists"| node_mongo
node_menustore -.->|"persists"| node_mongo
node_dishstore -.->|"persists"| node_mongo
node_orderstore -.->|"persists"| node_mongo

click node_browse "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurants/restaurants.component.ts"
click node_details "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-details/restaurant-details.component.ts"
click node_cart "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/cart.service.ts"
click node_checkout "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/checkout/checkout.component.ts"
click node_ordersview "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/my-orders/my-orders.component.ts"
click node_home "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/home/home.component.ts"
click node_authpages "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/login/login.component.ts"
click node_restportal "https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/pages/restaurant-dashboard"
click node_dishpage "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-dashboard/manage-dishes/manage-dishes.component.ts"
click node_orderpage "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-dashboard/manage-orders/manage-orders.component.ts"
click node_adminpages "https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/pages/admin-dashboard"
click node_statistics "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/admin-dashboard/statistics/statistics.component.ts"
click node_authsvc "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/auth.service.ts"
click node_restaurantsvc "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/restaurant.service.ts"
click node_catalogsvc "https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/core/services"
click node_ordersvc "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/order.service.ts"
click node_dashboard_svc "https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/dashboard.service.ts"
click node_server "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/server.js"
click node_authroutes "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/authRoutes.js"
click node_catalogroutes "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/restaurantRoutes.js"
click node_orderroutes "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/orderRoutes.js"
click node_dashroutes "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/dashboardRoutes.js"
click node_authctrl "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/authController.js"
click node_restctrl "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/restaurantController.js"
click node_orderctrl "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/orderController.js"
click node_dashctrl "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/dashboardController.js"
click node_access "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/middleware/authMiddleware.js"
click node_userstore "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/User.js"
click node_reststore "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Restaurant.js"
click node_menustore "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Category.js"
click node_dishstore "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Dish.js"
click node_orderstore "https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Order.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_browse,node_details,node_cart,node_checkout,node_ordersview,node_home,node_authpages,node_visitor toneBlue
class node_restportal,node_dishpage,node_orderpage,node_adminpages,node_statistics,node_mongo toneAmber
class node_authsvc,node_restaurantsvc,node_catalogsvc,node_ordersvc,node_dashboard_svc toneMint
class node_server,node_authroutes,node_catalogroutes,node_orderroutes,node_dashroutes,node_authctrl,node_restctrl,node_orderctrl,node_dashctrl,node_access toneRose
class node_userstore,node_reststore,node_menustore,node_dishstore,node_orderstore toneIndigo
```

## Components

### Customer experience

- [Restaurant browsing](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurants/restaurants.component.ts): `frontend/src/app/pages/restaurants/restaurants.component.ts`
- [Restaurant details](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-details/restaurant-details.component.ts): `frontend/src/app/pages/restaurant-details/restaurant-details.component.ts`
- [Cart](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/cart.service.ts): `frontend/src/app/core/services/cart.service.ts`
- [Checkout](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/checkout/checkout.component.ts): `frontend/src/app/pages/checkout/checkout.component.ts`
- [Order tracking](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/my-orders/my-orders.component.ts): `frontend/src/app/pages/my-orders/my-orders.component.ts`
- [Home and entry pages](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/home/home.component.ts): `frontend/src/app/pages/home/home.component.ts`
- [Login and registration](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/login/login.component.ts): `frontend/src/app/pages/login/login.component.ts`

### Management portals

- [Restaurant operations](https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/pages/restaurant-dashboard): `frontend/src/app/pages/restaurant-dashboard`
- [Dish management](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-dashboard/manage-dishes/manage-dishes.component.ts): `frontend/src/app/pages/restaurant-dashboard/manage-dishes/manage-dishes.component.ts`
- [Incoming orders](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/restaurant-dashboard/manage-orders/manage-orders.component.ts): `frontend/src/app/pages/restaurant-dashboard/manage-orders/manage-orders.component.ts`
- [Admin operations](https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/pages/admin-dashboard): `frontend/src/app/pages/admin-dashboard`
- [Admin statistics](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/pages/admin-dashboard/statistics/statistics.component.ts): `frontend/src/app/pages/admin-dashboard/statistics/statistics.component.ts`

### Angular core

- [Authentication service](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/auth.service.ts): `frontend/src/app/core/services/auth.service.ts`
- [Restaurant service](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/restaurant.service.ts): `frontend/src/app/core/services/restaurant.service.ts`
- [Menu services](https://github.com/sfe7/foodexpress-mean-stack/tree/main/frontend/src/app/core/services): `frontend/src/app/core/services`
- [Order service](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/order.service.ts): `frontend/src/app/core/services/order.service.ts`
- [Dashboard service](https://github.com/sfe7/foodexpress-mean-stack/blob/main/frontend/src/app/core/services/dashboard.service.ts): `frontend/src/app/core/services/dashboard.service.ts`

### API and domain

- [Express API server](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Restaurant and menu routes](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/restaurantRoutes.js): `backend/routes/restaurantRoutes.js`
- [Order routes](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Dashboard routes](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/routes/dashboardRoutes.js): `backend/routes/dashboardRoutes.js`
- [Authentication controller](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Restaurant controller](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/restaurantController.js): `backend/controllers/restaurantController.js`
- [Order controller](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Dashboard controller](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/controllers/dashboardController.js): `backend/controllers/dashboardController.js`
- [Access middleware](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Persistence

- [User records](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/User.js): `backend/models/User.js`
- [Restaurant records](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Restaurant.js): `backend/models/Restaurant.js`
- [Menu records](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Category.js): `backend/models/Category.js`
- [Dish records](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Dish.js): `backend/models/Dish.js`
- [Order records](https://github.com/sfe7/foodexpress-mean-stack/blob/main/backend/models/Order.js): `backend/models/Order.js`

### Other components

- **Visitor or user**
- **MongoDB**

## Connections

- Visitor or user → Restaurant browsing: browses
- Visitor or user → Login and registration: signs in
- Restaurant browsing → Restaurant service: requests listings (evidence: `frontend/src/app/core/services/restaurant.service.ts`)
- Restaurant details → Restaurant service: requests details (evidence: `frontend/src/app/core/services/restaurant.service.ts`)
- Restaurant details → Menu services: loads menu (evidence: `frontend/src/app/pages/restaurant-details/restaurant-details.component.ts`)
- Restaurant details → Cart: adds dishes (evidence: `frontend/src/app/pages/restaurant-details/restaurant-details.component.ts`)
- Checkout → Cart: reads cart (evidence: `frontend/src/app/pages/checkout/checkout.component.ts`)
- Checkout → Order service: submits order (evidence: `frontend/src/app/pages/checkout/checkout.component.ts`)
- Order tracking → Order service: loads orders (evidence: `frontend/src/app/pages/my-orders/my-orders.component.ts`)
- Login and registration → Authentication service: authenticates (evidence: `frontend/src/app/core/services/auth.service.ts`)
- Restaurant operations → Restaurant service: selects restaurants (evidence: `frontend/src/app/pages/restaurant-dashboard/manage-dishes/manage-dishes.component.ts`)
- Dish management → Menu services: manages menu (evidence: `frontend/src/app/pages/restaurant-dashboard/manage-dishes/manage-dishes.component.ts`)
- Incoming orders → Order service: manages orders (evidence: `frontend/src/app/pages/restaurant-dashboard/manage-orders/manage-orders.component.ts`)
- Admin operations → Restaurant service: reviews restaurants (evidence: `frontend/src/app/pages/admin-dashboard/restaurants/restaurants.component.ts`)
- Admin statistics → Dashboard service: loads KPIs
- Authentication service → Authentication routes: calls auth API
- Restaurant service → Restaurant and menu routes: calls restaurant API (evidence: `frontend/src/app/core/services/restaurant.service.ts`)
- Order service → Order routes: calls order API
- Express API server → Authentication routes: mounts (evidence: `backend/server.js`)
- Express API server → Restaurant and menu routes: mounts (evidence: `backend/server.js`)
- Express API server → Order routes: mounts (evidence: `backend/server.js`)
- Express API server → Dashboard routes: mounts (evidence: `backend/server.js`)
- Authentication routes → Authentication controller: routes requests (evidence: `backend/routes/authRoutes.js`)
- Restaurant and menu routes → Restaurant controller: routes restaurant requests (evidence: `backend/routes/restaurantRoutes.js`)
- Order routes → Order controller: routes order requests (evidence: `backend/routes/orderRoutes.js`)
- Dashboard routes → Dashboard controller: routes dashboard requests (evidence: `backend/routes/dashboardRoutes.js`)
- Authentication routes → Access middleware: protects routes (evidence: `backend/routes/authRoutes.js`)
- Order routes → Access middleware: protects routes (evidence: `backend/routes/orderRoutes.js`)
- Authentication controller → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Access middleware → User records: loads identity (evidence: `backend/middleware/authMiddleware.js`)
- Restaurant controller → Restaurant records: reads and writes (evidence: `backend/controllers/restaurantController.js`)
- Restaurant controller → Dish records: deletes dishes (evidence: `backend/controllers/restaurantController.js`)
- Restaurant controller → Menu records: deletes categories (evidence: `backend/controllers/restaurantController.js`)
- Order controller → Order records: creates and updates (evidence: `backend/controllers/orderController.js`)
- Order controller → Dish records: validates prices (evidence: `backend/controllers/orderController.js`)
- Order controller → Restaurant records: checks restaurant (evidence: `backend/controllers/orderController.js`)
- Dashboard controller → Order records: aggregates KPIs (evidence: `backend/controllers/dashboardController.js`)
- Dashboard controller → Restaurant records: counts restaurants (evidence: `backend/controllers/dashboardController.js`)
- Dashboard controller → User records: counts users (evidence: `backend/controllers/dashboardController.js`)
- User records → MongoDB: persists
- Restaurant records → MongoDB: persists
- Menu records → MongoDB: persists
- Dish records → MongoDB: persists
- Order records → MongoDB: persists
