# nguyendinhhoai1207/24ct_nguyendinhhoai architecture

> Architecture diagram of the GitHub repository nguyendinhhoai1207/24ct_nguyendinhhoai, 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/24ct_nguyendinhhoai
- Repository: https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai

## Overview

This is a MERN pizza-ordering application. Customers browse and filter the menu, customize items, manage a cart, submit an order, and track its status; admins manage pizzas and orders and view sales statistics. The frontend coordinates these experiences through a shared API client, while Express routes dispatch to controllers that use MongoDB or a persistent JSON fallback. Several UI capabilities and server subsystems are documented but not fully excerpted, so their internal links are omitted where implementation evidence is unavailable.

Main entry points: [`client/src/App.jsx`](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/App.jsx) (App coordinator), [`client/src/services/api.js`](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/services/api.js) (API client), [`server/data/store.js`](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/data/store.js) (JSON fallback store), [`server/controllers/pizzaController.js`](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/pizzaController.js) (Pizza operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_app["App coordinator<br/>[App.jsx]"]
  node_menu_ui["Menu browsing<br/>[App.jsx]"]
  node_pizza_card["Pizza cards<br/>[PizzaCard.jsx]"]
  node_pizza_custom["Pizza customization<br/>[PizzaModal.jsx]"]
  node_cart["Cart state<br/>[CartContext.jsx]"]
  node_cart_ui["Cart drawer<br/>[CartDrawer.jsx]"]
  node_checkout["Checkout<br/>[CheckoutModal.jsx]"]
  node_tracking["Order tracking<br/>[OrderTracker.jsx]"]
  node_auth_ui["Authentication UI<br/>[AuthModal.jsx]"]
  node_auth_state["Auth state<br/>[AuthContext.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_hero["Hero banner<br/>[HeroBanner.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_backend["API services"]
  node_api_client["API client<br/>[api.js]"]
  node_express["Express API<br/>[server.js]"]
  node_pizza_routes["Pizza routes<br/>[pizzaRoutes.js]"]
  node_pizza_controller["Pizza operations<br/>[pizzaController.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_order_controller["Order operations<br/>[orderController.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Auth operations<br/>[authController.js]"]
  node_auth_middleware["Token protection<br/>[authMiddleware.js]"]
end

subgraph group_persistence["Persistence and models"]
  node_db_config["Mongo connection<br/>[db.js]"]
  node_store[("JSON fallback store<br/>[store.js]")]
  node_sample_pizzas["Sample menu data<br/>[samplePizzas.js]"]
  node_pizza_model["Pizza model<br/>[Pizza.js]"]
  node_order_model["Order model<br/>[Order.js]"]
  node_user_model["User model<br/>[User.js]"]
end

node_customer(("Customer"))
node_admin_user(("Admin"))
node_mongodb[("MongoDB")]
node_local_storage[("Browser local storage")]

node_customer -->|"uses"| node_app
node_admin_user -->|"manages"| node_admin_ui
node_app -->|"renders"| node_menu_ui
node_app -->|"renders"| node_pizza_card
node_app -->|"renders"| node_pizza_custom
node_app -->|"renders"| node_cart_ui
node_app -->|"renders"| node_checkout
node_app -->|"renders"| node_tracking
node_app -->|"renders"| node_admin_ui
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_hero
node_app -->|"fetches menu"| node_api_client
node_pizza_custom -->|"adds items"| node_cart
node_cart_ui -->|"reads cart"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"submits order"| node_api_client
node_tracking -->|"looks up order"| node_api_client
node_admin_ui -->|"manages data"| node_api_client
node_auth_ui -->|"authenticates"| node_auth_state
node_auth_state -->|"loads identity"| node_api_client
node_cart -->|"persists cart"| node_local_storage
node_api_client -.->|"calls API"| node_express
node_express -->|"mounts"| node_pizza_routes
node_express -->|"mounts"| node_order_routes
node_express -->|"mounts"| node_auth_routes
node_pizza_routes -->|"dispatches"| node_pizza_controller
node_order_routes -->|"dispatches"| node_order_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"protects route"| node_auth_middleware
node_pizza_controller -->|"queries"| node_pizza_model
node_pizza_controller -->|"uses fallback"| node_store
node_order_controller -->|"queries"| node_order_model
node_order_controller -->|"uses fallback"| node_store
node_auth_controller -->|"queries"| node_user_model
node_auth_controller -->|"uses fallback"| node_store
node_pizza_controller -->|"checks mode"| node_db_config
node_order_controller -->|"checks mode"| node_db_config
node_auth_controller -->|"checks mode"| node_db_config
node_auth_middleware -->|"loads user"| node_user_model
node_auth_middleware -->|"uses fallback"| node_store
node_db_config -->|"connects"| node_mongodb
node_store -->|"seeds menu"| node_sample_pizzas
node_pizza_controller -->|"reads and writes"| node_store

click node_app "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/App.jsx"
click node_menu_ui "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/App.jsx"
click node_pizza_card "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/PizzaCard.jsx"
click node_pizza_custom "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/PizzaModal.jsx"
click node_cart "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/context/CartContext.jsx"
click node_cart_ui "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/CartDrawer.jsx"
click node_checkout "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/CheckoutModal.jsx"
click node_tracking "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/OrderTracker.jsx"
click node_auth_ui "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/AuthModal.jsx"
click node_auth_state "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/context/AuthContext.jsx"
click node_navbar "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/Navbar.jsx"
click node_hero "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/HeroBanner.jsx"
click node_admin_ui "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/AdminDashboard.jsx"
click node_api_client "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/services/api.js"
click node_express "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/server.js"
click node_pizza_routes "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/pizzaRoutes.js"
click node_pizza_controller "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/pizzaController.js"
click node_order_routes "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/orderRoutes.js"
click node_order_controller "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/orderController.js"
click node_auth_routes "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/authRoutes.js"
click node_auth_controller "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/authController.js"
click node_auth_middleware "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/middleware/authMiddleware.js"
click node_db_config "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/config/db.js"
click node_store "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/data/store.js"
click node_sample_pizzas "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/data/samplePizzas.js"
click node_pizza_model "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/Pizza.js"
click node_order_model "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/Order.js"
click node_user_model "https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/User.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_ui,node_pizza_card,node_pizza_custom,node_cart,node_cart_ui,node_checkout,node_tracking,node_auth_ui,node_auth_state,node_navbar,node_hero toneBlue
class node_admin_ui,node_mongodb,node_local_storage toneAmber
class node_api_client,node_express,node_pizza_routes,node_pizza_controller,node_order_routes,node_order_controller,node_auth_routes,node_auth_controller,node_auth_middleware toneMint
class node_db_config,node_store,node_sample_pizzas,node_pizza_model,node_order_model,node_user_model toneRose
class node_customer,node_admin_user toneIndigo
```

## Components

### Customer experience

- [App coordinator](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Menu browsing](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Pizza cards](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/PizzaCard.jsx): `client/src/components/PizzaCard.jsx`
- [Pizza customization](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/PizzaModal.jsx): `client/src/components/PizzaModal.jsx`
- [Cart state](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/context/CartContext.jsx): `client/src/context/CartContext.jsx`
- [Cart drawer](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/CartDrawer.jsx): `client/src/components/CartDrawer.jsx`
- [Checkout](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/CheckoutModal.jsx): `client/src/components/CheckoutModal.jsx`
- [Order tracking](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/OrderTracker.jsx): `client/src/components/OrderTracker.jsx`
- [Authentication UI](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/AuthModal.jsx): `client/src/components/AuthModal.jsx`
- [Auth state](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Navigation](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/Navbar.jsx): `client/src/components/Navbar.jsx`
- [Hero banner](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/HeroBanner.jsx): `client/src/components/HeroBanner.jsx`

### Administration

- [Admin dashboard](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/components/AdminDashboard.jsx): `client/src/components/AdminDashboard.jsx`

### API services

- [API client](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Express API](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/server.js): `server/server.js`
- [Pizza routes](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/pizzaRoutes.js): `server/routes/pizzaRoutes.js`
- [Pizza operations](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/pizzaController.js): `server/controllers/pizzaController.js`
- [Order routes](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/orderRoutes.js): `server/routes/orderRoutes.js`
- [Order operations](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/orderController.js): `server/controllers/orderController.js`
- [Auth routes](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Auth operations](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Token protection](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Persistence and models

- [Mongo connection](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/config/db.js): `server/config/db.js`
- [JSON fallback store](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/data/store.js): `server/data/store.js`
- [Sample menu data](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/data/samplePizzas.js): `server/data/samplePizzas.js`
- [Pizza model](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/Pizza.js): `server/models/Pizza.js`
- [Order model](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/Order.js): `server/models/Order.js`
- [User model](https://github.com/nguyendinhhoai1207/24ct_nguyendinhhoai/blob/main/server/models/User.js): `server/models/User.js`

### Other components

- **Customer**
- **Admin**
- **MongoDB**
- **Browser local storage**

## Connections

- Customer → App coordinator: uses (evidence: `README.md`)
- Admin → Admin dashboard: manages (evidence: `README.md`)
- App coordinator → Menu browsing: renders (evidence: `client/src/App.jsx`)
- App coordinator → Pizza cards: renders (evidence: `client/src/App.jsx`)
- App coordinator → Pizza customization: renders (evidence: `client/src/App.jsx`)
- App coordinator → Cart drawer: renders (evidence: `client/src/App.jsx`)
- App coordinator → Checkout: renders (evidence: `client/src/App.jsx`)
- App coordinator → Order tracking: renders (evidence: `client/src/App.jsx`)
- App coordinator → Admin dashboard: renders (evidence: `client/src/App.jsx`)
- App coordinator → Authentication UI: renders (evidence: `client/src/App.jsx`)
- App coordinator → Navigation: renders (evidence: `client/src/App.jsx`)
- App coordinator → Hero banner: renders (evidence: `client/src/App.jsx`)
- App coordinator → API client: fetches menu (evidence: `client/src/App.jsx`)
- Pizza customization → Cart state: adds items (evidence: `client/src/components/PizzaModal.jsx`)
- Cart drawer → Cart state: reads cart (evidence: `client/src/components/CartDrawer.jsx`)
- Checkout → Cart state: reads cart (evidence: `client/src/components/CheckoutModal.jsx`)
- Checkout → API client: submits 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 data (evidence: `client/src/components/AdminDashboard.jsx`)
- Authentication UI → Auth state: authenticates (evidence: `client/src/components/AuthModal.jsx`)
- Auth state → API client: loads identity (evidence: `client/src/context/AuthContext.jsx`)
- Cart state → Browser local storage: persists cart (evidence: `client/src/context/CartContext.jsx`)
- API client → Express API: calls API (evidence: `README.md`)
- Express API → Pizza routes: mounts (evidence: `server/server.js`)
- Express API → Order routes: mounts (evidence: `server/server.js`)
- Express API → Auth routes: mounts (evidence: `server/server.js`)
- Pizza routes → Pizza operations: dispatches (evidence: `server/routes/pizzaRoutes.js`)
- Order routes → Order operations: dispatches (evidence: `server/routes/orderRoutes.js`)
- Auth routes → Auth operations: dispatches (evidence: `server/routes/authRoutes.js`)
- Auth routes → Token protection: protects route (evidence: `server/routes/authRoutes.js`)
- Pizza operations → Pizza model: queries (evidence: `server/controllers/pizzaController.js`)
- Pizza operations → JSON fallback store: uses fallback (evidence: `server/controllers/pizzaController.js`)
- Order operations → Order model: queries (evidence: `server/controllers/orderController.js`)
- Order operations → JSON fallback store: uses fallback (evidence: `server/controllers/orderController.js`)
- Auth operations → User model: queries (evidence: `server/controllers/authController.js`)
- Auth operations → JSON fallback store: uses fallback (evidence: `server/controllers/authController.js`)
- Pizza operations → Mongo connection: checks mode (evidence: `server/controllers/pizzaController.js`)
- Order operations → Mongo connection: checks mode (evidence: `server/controllers/orderController.js`)
- Auth operations → Mongo connection: checks mode (evidence: `server/controllers/authController.js`)
- Token protection → User model: loads user (evidence: `server/middleware/authMiddleware.js`)
- Token protection → JSON fallback store: uses fallback (evidence: `server/middleware/authMiddleware.js`)
- Mongo connection → MongoDB: connects (evidence: `server/config/db.js`)
- JSON fallback store → Sample menu data: seeds menu (evidence: `server/data/store.js`)
- Pizza operations → JSON fallback store: reads and writes (evidence: `server/controllers/pizzaController.js`)
