# nguyendinhhoai1207/pizza-deluxe architecture

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

- Interactive diagram: https://gitdiagram.com/nguyendinhhoai1207/pizza-deluxe
- Repository: https://github.com/nguyendinhhoai1207/pizza-deluxe

## Overview

This is a customer-facing pizza ordering app with an admin dashboard. The customer flow is menu discovery and customization, cart and checkout, order creation, then tracking; administrators manage pizzas, orders, and sales summaries. The client calls a REST API, whose controllers select MongoDB or the persistent JSON fallback. Edges reflect the supplied imports, calls, route registrations, or README statements; several UI capabilities are documented but their detailed implementation was not sampled.

Main entry points: [`client/src/App.jsx`](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/App.jsx) (App shell), [`server/server.js`](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/server.js) (API server), [`server/controllers/orderController.js`](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/orderController.js) (Order handling), [`client/src/services/api.js`](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer app"]
  node_app["App shell<br/>[App.jsx]"]
  node_menu["Menu browsing<br/>[PizzaCard.jsx]"]
  node_customize["Pizza customization<br/>[PizzaModal.jsx]"]
  node_cart[("Cart state<br/>[CartContext.jsx]")]
  node_cartui["Cart drawer<br/>[CartDrawer.jsx]"]
  node_checkout["Checkout<br/>[CheckoutModal.jsx]"]
  node_tracking["Order tracking<br/>[OrderTracker.jsx]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_authui["Account access<br/>[AuthModal.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_server["API server<br/>[server.js]"]
  node_pizza_routes["Pizza routes<br/>[pizzaRoutes.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
end

subgraph group_domain["Commerce services"]
  node_pizza_ctrl["Menu management<br/>[pizzaController.js]"]
  node_order_ctrl["Order handling<br/>[orderController.js]"]
  node_auth_ctrl["Authentication<br/>[authController.js]"]
  node_auth_middleware["Access control<br/>[authMiddleware.js]"]
end

subgraph group_persistence["Persistence"]
  node_pizza_model["Pizza model<br/>[Pizza.js]"]
  node_order_model["Order model<br/>[Order.js]"]
  node_user_model["User model<br/>[User.js]"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_fallback[("JSON fallback store<br/>[store.js]")]
  node_samples["Seed menu data<br/>[samplePizzas.js]"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))

node_shopper -->|"uses"| node_app
node_admin -->|"manages"| node_adminui
node_app -->|"renders"| node_menu
node_app -->|"renders"| node_customize
node_app -->|"renders"| node_cartui
node_app -->|"renders"| node_checkout
node_app -->|"renders"| node_tracking
node_app -->|"renders"| node_adminui
node_menu -->|"loads menu"| node_api_client
node_customize -->|"adds item"| node_cart
node_cartui -->|"reads and updates"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"creates order"| node_api_client
node_tracking -->|"looks up order"| node_api_client
node_adminui -->|"manages catalog and orders"| node_api_client
node_authui -->|"authenticates"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_pizza_routes
node_server -->|"mounts"| node_order_routes
node_server -->|"mounts"| node_auth_routes
node_pizza_routes -->|"dispatches"| node_pizza_ctrl
node_order_routes -->|"dispatches"| node_order_ctrl
node_auth_routes -->|"dispatches"| node_auth_ctrl
node_pizza_ctrl -->|"queries"| node_pizza_model
node_pizza_ctrl -->|"uses when offline"| node_fallback
node_order_ctrl -->|"queries"| node_order_model
node_order_ctrl -->|"uses when offline"| node_fallback
node_auth_ctrl -->|"looks up users"| node_user_model
node_auth_ctrl -->|"uses when offline"| node_fallback
node_auth_routes -->|"protects routes"| node_auth_middleware
node_auth_middleware -->|"loads user"| node_user_model
node_auth_middleware -->|"uses when offline"| node_fallback
node_pizza_ctrl -->|"checks connection"| node_mongo
node_order_ctrl -->|"checks connection"| node_mongo
node_auth_ctrl -->|"checks connection"| node_mongo
node_auth_middleware -->|"checks connection"| node_mongo
node_server -->|"connects"| node_mongo
node_server -->|"initializes"| node_fallback
node_fallback -->|"initializes menu from"| node_samples
node_pizza_ctrl -.->|"supports catalog CRUD"| node_admin
node_order_ctrl -.->|"supports order operations and stats"| node_admin
node_order_ctrl -.->|"provides order tracking"| node_shopper

click node_app "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/App.jsx"
click node_menu "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/PizzaCard.jsx"
click node_customize "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/PizzaModal.jsx"
click node_cart "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/context/CartContext.jsx"
click node_cartui "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/CartDrawer.jsx"
click node_checkout "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/CheckoutModal.jsx"
click node_tracking "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/OrderTracker.jsx"
click node_adminui "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/AdminDashboard.jsx"
click node_authui "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/AuthModal.jsx"
click node_api_client "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/services/api.js"
click node_server "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/server.js"
click node_pizza_routes "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/pizzaRoutes.js"
click node_order_routes "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/orderRoutes.js"
click node_auth_routes "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/authRoutes.js"
click node_pizza_ctrl "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/pizzaController.js"
click node_order_ctrl "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/orderController.js"
click node_auth_ctrl "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/authController.js"
click node_auth_middleware "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/middleware/authMiddleware.js"
click node_pizza_model "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/Pizza.js"
click node_order_model "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/Order.js"
click node_user_model "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/User.js"
click node_mongo "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/config/db.js"
click node_fallback "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/data/store.js"
click node_samples "https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/data/samplePizzas.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_app,node_menu,node_customize,node_cart,node_cartui,node_checkout,node_tracking,node_adminui,node_authui,node_api_client toneBlue
class node_server,node_pizza_routes,node_order_routes,node_auth_routes toneAmber
class node_pizza_ctrl,node_order_ctrl,node_auth_ctrl,node_auth_middleware toneMint
class node_pizza_model,node_order_model,node_user_model,node_mongo,node_fallback,node_samples toneRose
class node_shopper,node_admin toneIndigo
```

## Components

### Customer app

- [App shell](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Menu browsing](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/PizzaCard.jsx): `client/src/components/PizzaCard.jsx`
- [Pizza customization](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/PizzaModal.jsx): `client/src/components/PizzaModal.jsx`
- [Cart state](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/context/CartContext.jsx): `client/src/context/CartContext.jsx`
- [Cart drawer](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/CartDrawer.jsx): `client/src/components/CartDrawer.jsx`
- [Checkout](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/CheckoutModal.jsx): `client/src/components/CheckoutModal.jsx`
- [Order tracking](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/OrderTracker.jsx): `client/src/components/OrderTracker.jsx`
- [Admin dashboard](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/AdminDashboard.jsx): `client/src/components/AdminDashboard.jsx`
- [Account access](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/components/AuthModal.jsx): `client/src/components/AuthModal.jsx`
- [API client](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/client/src/services/api.js): `client/src/services/api.js`

### REST API

- [API server](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/server.js): `server/server.js`
- [Pizza routes](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/pizzaRoutes.js): `server/routes/pizzaRoutes.js`
- [Order routes](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/orderRoutes.js): `server/routes/orderRoutes.js`
- [Auth routes](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`

### Commerce services

- [Menu management](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/pizzaController.js): `server/controllers/pizzaController.js`
- [Order handling](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/orderController.js): `server/controllers/orderController.js`
- [Authentication](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Access control](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Persistence

- [Pizza model](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/Pizza.js): `server/models/Pizza.js`
- [Order model](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/Order.js): `server/models/Order.js`
- [User model](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/models/User.js): `server/models/User.js`
- [MongoDB](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/config/db.js): `server/config/db.js`
- [JSON fallback store](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/data/store.js): `server/data/store.js`
- [Seed menu data](https://github.com/nguyendinhhoai1207/pizza-deluxe/blob/main/server/data/samplePizzas.js): `server/data/samplePizzas.js`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → App shell: uses (evidence: `README.md`)
- Administrator → Admin dashboard: manages (evidence: `README.md`)
- App shell → Menu browsing: renders (evidence: `client/src/App.jsx`)
- App shell → Pizza customization: renders (evidence: `client/src/App.jsx`)
- App shell → Cart drawer: renders (evidence: `client/src/App.jsx`)
- App shell → Checkout: renders (evidence: `client/src/App.jsx`)
- App shell → Order tracking: renders (evidence: `client/src/App.jsx`)
- App shell → Admin dashboard: renders (evidence: `client/src/App.jsx`)
- Menu browsing → API client: loads menu (evidence: `client/src/App.jsx`)
- Pizza customization → Cart state: adds item (evidence: `client/src/components/PizzaModal.jsx`)
- Cart drawer → Cart state: reads and updates (evidence: `client/src/components/CartDrawer.jsx`)
- Checkout → Cart state: reads cart (evidence: `client/src/components/CheckoutModal.jsx`)
- Checkout → API client: creates order (evidence: `client/src/components/CheckoutModal.jsx`)
- Order tracking → API client: looks up order (evidence: `client/src/components/OrderTracker.jsx`)
- Admin dashboard → API client: manages catalog and orders (evidence: `client/src/components/AdminDashboard.jsx`)
- Account access → API client: authenticates (evidence: `client/src/components/AuthModal.jsx`)
- API client → API server: HTTP requests (evidence: `client/src/services/api.js`)
- API server → Pizza routes: mounts (evidence: `server/server.js`)
- API server → Order routes: mounts (evidence: `server/server.js`)
- API server → Auth routes: mounts (evidence: `server/server.js`)
- Pizza routes → Menu management: dispatches (evidence: `server/routes/pizzaRoutes.js`)
- Order routes → Order handling: dispatches (evidence: `server/routes/orderRoutes.js`)
- Auth routes → Authentication: dispatches (evidence: `server/routes/authRoutes.js`)
- Menu management → Pizza model: queries (evidence: `server/controllers/pizzaController.js`)
- Menu management → JSON fallback store: uses when offline (evidence: `server/controllers/pizzaController.js`)
- Order handling → Order model: queries (evidence: `server/controllers/orderController.js`)
- Order handling → JSON fallback store: uses when offline (evidence: `server/controllers/orderController.js`)
- Authentication → User model: looks up users (evidence: `server/controllers/authController.js`)
- Authentication → JSON fallback store: uses when offline (evidence: `server/controllers/authController.js`)
- Auth routes → Access control: protects routes (evidence: `server/routes/authRoutes.js`)
- Access control → User model: loads user (evidence: `server/middleware/authMiddleware.js`)
- Access control → JSON fallback store: uses when offline (evidence: `server/middleware/authMiddleware.js`)
- Menu management → MongoDB: checks connection (evidence: `server/controllers/pizzaController.js`)
- Order handling → MongoDB: checks connection (evidence: `server/controllers/orderController.js`)
- Authentication → MongoDB: checks connection (evidence: `server/controllers/authController.js`)
- Access control → MongoDB: checks connection (evidence: `server/middleware/authMiddleware.js`)
- API server → MongoDB: connects (evidence: `server/server.js`)
- API server → JSON fallback store: initializes (evidence: `server/server.js`)
- JSON fallback store → Seed menu data: initializes menu from (evidence: `server/data/store.js`)
- Menu management → Administrator: supports catalog CRUD (evidence: `README.md`)
- Order handling → Administrator: supports order operations and stats (evidence: `README.md`)
- Order handling → Shopper: provides order tracking (evidence: `README.md`)
