# mmchouuu/cn_foodfast architecture

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

- Interactive diagram: https://gitdiagram.com/mmchouuu/cn_foodfast
- Repository: https://github.com/mmchouuu/cn_foodfast

## Overview

CN_FoodFast is a food-ordering and delivery platform: customers browse restaurants and dishes, build a cart, check out, and follow orders; restaurant staff manage menus and orders, while administrators oversee accounts and operations. The React client reaches Express services through an API gateway, with separate user, product, order, and payment services. README documents PostgreSQL, RabbitMQ, email, and realtime capabilities; the sampled source confirms selected client routing and service calls. Several backend connections are documented at architecture level rather than verified in sampled callers.

Main entry points: [`client/src/App.jsx`](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/App.jsx) (Client routes), [`client/src/context/AppContext.jsx`](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/context/AppContext.jsx) (App state), [`server/apps/api-gateway/src/routes`](https://github.com/mmchouuu/cn_foodfast/tree/main/server/apps/api-gateway/src/routes) (API routes), [`server/apps/order-service/src/db/index.js`](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/order-service/src/db/index.js) (PostgreSQL stores)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_clientapp["Client routes<br/>[App.jsx]"]
  node_clientstate["App state<br/>[AppContext.jsx]"]
  node_catalogui["Restaurant browsing<br/>[Restaurants.jsx]"]
  node_dishui["Dish details<br/>[DishDetail.jsx]"]
  node_cartui["Cart and checkout<br/>[Checkout.jsx]"]
  node_orderui["Order tracking<br/>[CurrentOrder.jsx]"]
end

subgraph group_operations["Restaurant and admin"]
  node_ownerui["Restaurant console<br/>[MenuManagement.jsx]"]
  node_adminui["Admin console<br/>[AdminDashboard.jsx]"]
end

subgraph group_gateway["API access"]
  node_gatewayapi["API gateway<br/>[index.js]"]
  node_gatewayroutes["API routes"]
end

subgraph group_domains["Domain services"]
  node_userdomain["Accounts and addresses<br/>[user.service.js]"]
  node_productdomain["Catalog and menus<br/>[catalog.service.js]"]
  node_orderdomain["Order management<br/>[order.service.js]"]
  node_paymentdomain["Payments and settlements"]
  node_postgres[("PostgreSQL stores<br/>[index.js]")]
end

subgraph group_integrations["Events and integrations"]
  node_rabbit["RabbitMQ events<br/>[rabbit.js]"]
  node_email["Email delivery<br/>[mailer.js]"]
  node_socket["Realtime gateway<br/>[index.js]"]
  node_stripe["Stripe payments<br/>[stripe.js]"]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_clientapp
node_clientapp -->|"routes to"| node_catalogui
node_clientapp -->|"routes to"| node_dishui
node_clientapp -->|"routes to"| node_cartui
node_clientapp -->|"routes to"| node_orderui
node_clientapp -->|"routes to"| node_ownerui
node_clientapp -->|"routes to"| node_adminui
node_catalogui -.->|"uses state"| node_clientstate
node_dishui -.->|"uses state"| node_clientstate
node_cartui -->|"uses state"| node_clientstate
node_orderui -.->|"uses state"| node_clientstate
node_ownerui -->|"uses state"| node_clientstate
node_clientstate -.->|"sends API requests"| node_gatewayapi
node_gatewayapi -.->|"dispatches"| node_gatewayroutes
node_gatewayroutes -.->|"forwards account requests"| node_userdomain
node_gatewayroutes -.->|"forwards catalog requests"| node_productdomain
node_gatewayroutes -.->|"forwards order requests"| node_orderdomain
node_gatewayroutes -.->|"forwards payment requests"| node_paymentdomain
node_orderdomain -.->|"persists orders"| node_postgres
node_userdomain -.->|"persists accounts"| node_postgres
node_productdomain -.->|"persists catalog"| node_postgres
node_paymentdomain -.->|"persists payments"| node_postgres
node_paymentdomain -.->|"integrates payments"| node_stripe
node_orderdomain -.->|"publishes events"| node_rabbit
node_rabbit -.->|"notifies"| node_email
node_rabbit -.->|"relays realtime events"| node_socket

click node_clientapp "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/App.jsx"
click node_clientstate "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/context/AppContext.jsx"
click node_catalogui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/Restaurants.jsx"
click node_dishui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/DishDetail.jsx"
click node_cartui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/Checkout.jsx"
click node_orderui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/CurrentOrder.jsx"
click node_ownerui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/owner/MenuManagement.jsx"
click node_adminui "https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/admin/AdminDashboard.jsx"
click node_gatewayapi "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/api-gateway/src/index.js"
click node_gatewayroutes "https://github.com/mmchouuu/cn_foodfast/tree/main/server/apps/api-gateway/src/routes"
click node_userdomain "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/user-service/src/services/user.service.js"
click node_productdomain "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/product-service/src/services/catalog.service.js"
click node_orderdomain "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/order-service/src/services/order.service.js"
click node_paymentdomain "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/payment-service/src/services/payments.service.js"
click node_postgres "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/order-service/src/db/index.js"
click node_rabbit "https://github.com/mmchouuu/cn_foodfast/blob/main/server/libs/events/rabbit.js"
click node_email "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/email-service/src/mailer.js"
click node_socket "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/socket-gateway/src/index.js"
click node_stripe "https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/payment-service/src/clients/stripe.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_clientapp,node_clientstate,node_catalogui,node_dishui,node_cartui,node_orderui toneBlue
class node_ownerui,node_adminui toneAmber
class node_gatewayapi,node_gatewayroutes toneMint
class node_userdomain,node_productdomain,node_orderdomain,node_paymentdomain,node_postgres toneRose
class node_rabbit,node_email,node_socket,node_stripe,node_customer toneIndigo
```

## Components

### Customer experience

- [Client routes](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [App state](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/context/AppContext.jsx): `client/src/context/AppContext.jsx`
- [Restaurant browsing](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/Restaurants.jsx): `client/src/pages/Restaurants.jsx`
- [Dish details](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/DishDetail.jsx): `client/src/pages/DishDetail.jsx`
- [Cart and checkout](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Order tracking](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/CurrentOrder.jsx): `client/src/pages/CurrentOrder.jsx`

### Restaurant and admin

- [Restaurant console](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/owner/MenuManagement.jsx): `client/src/pages/owner/MenuManagement.jsx`
- [Admin console](https://github.com/mmchouuu/cn_foodfast/blob/main/client/src/pages/admin/AdminDashboard.jsx): `client/src/pages/admin/AdminDashboard.jsx`

### API access

- [API gateway](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/api-gateway/src/index.js): `server/apps/api-gateway/src/index.js`
- [API routes](https://github.com/mmchouuu/cn_foodfast/tree/main/server/apps/api-gateway/src/routes): `server/apps/api-gateway/src/routes`

### Domain services

- [Accounts and addresses](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/user-service/src/services/user.service.js): `server/apps/user-service/src/services/user.service.js`
- [Catalog and menus](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/product-service/src/services/catalog.service.js): `server/apps/product-service/src/services/catalog.service.js`
- [Order management](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/order-service/src/services/order.service.js): `server/apps/order-service/src/services/order.service.js`
- [Payments and settlements](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/payment-service/src/services/payments.service.js): `server/apps/payment-service/src/services/payments.service.js`
- [PostgreSQL stores](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/order-service/src/db/index.js): `server/apps/order-service/src/db/index.js`

### Events and integrations

- [RabbitMQ events](https://github.com/mmchouuu/cn_foodfast/blob/main/server/libs/events/rabbit.js): `server/libs/events/rabbit.js`
- [Email delivery](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/email-service/src/mailer.js): `server/apps/email-service/src/mailer.js`
- [Realtime gateway](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/socket-gateway/src/index.js): `server/apps/socket-gateway/src/index.js`
- [Stripe payments](https://github.com/mmchouuu/cn_foodfast/blob/main/server/apps/payment-service/src/clients/stripe.js): `server/apps/payment-service/src/clients/stripe.js`

### Other components

- **Customer**

## Connections

- Customer → Client routes: uses (evidence: `README.md`)
- Client routes → Restaurant browsing: routes to (evidence: `client/src/App.jsx`)
- Client routes → Dish details: routes to (evidence: `client/src/App.jsx`)
- Client routes → Cart and checkout: routes to (evidence: `client/src/App.jsx`)
- Client routes → Order tracking: routes to (evidence: `client/src/App.jsx`)
- Client routes → Restaurant console: routes to (evidence: `client/src/App.jsx`)
- Client routes → Admin console: routes to (evidence: `client/src/App.jsx`)
- Restaurant browsing → App state: uses state
- Dish details → App state: uses state
- Cart and checkout → App state: uses state (evidence: `client/src/pages/Checkout.jsx`)
- Order tracking → App state: uses state
- Restaurant console → App state: uses state (evidence: `client/src/pages/owner/MenuManagement.jsx`)
- App state → API gateway: sends API requests
- API gateway → API routes: dispatches
- API routes → Accounts and addresses: forwards account requests
- API routes → Catalog and menus: forwards catalog requests
- API routes → Order management: forwards order requests
- API routes → Payments and settlements: forwards payment requests
- Order management → PostgreSQL stores: persists orders
- Accounts and addresses → PostgreSQL stores: persists accounts
- Catalog and menus → PostgreSQL stores: persists catalog
- Payments and settlements → PostgreSQL stores: persists payments
- Payments and settlements → Stripe payments: integrates payments
- Order management → RabbitMQ events: publishes events
- RabbitMQ events → Email delivery: notifies
- RabbitMQ events → Realtime gateway: relays realtime events
