# fuhl-sp26-sep490-g13/coffee-shop architecture

> Architecture diagram of the GitHub repository fuhl-sp26-sep490-g13/coffee-shop, 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/fuhl-sp26-sep490-g13/coffee-shop
- Repository: https://github.com/fuhl-sp26-sep490-g13/coffee-shop

## Overview

Coffee Shop Management is a multi-role cafe platform for customer ordering, in-store and takeaway operations, catalog administration, payments, loyalty, and workforce management. The principal customer flow is browsing products, building a cart, checking out, and tracking orders; staff and baristas handle fulfillment, while managers configure the store and oversee operations. The backend is an Express API with domain services and repositories, plus scheduled jobs and socket notifications. The README is empty and many domain files were not sampled, so undocumented links are omitted or marked unverified.

Main entry points: [`coffee-shop-backend/src/controllers/OrderOnlineController.js`](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/OrderOnlineController.js) (Order API), [`coffee-shop-frontend/src/services/axiosClient.js`](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/services/axiosClient.js) (API Client), [`coffee-shop-backend/src/controllers/ReviewController.js`](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/ReviewController.js) (Reviews), [`coffee-shop-backend/src/app.js`](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/app.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer Commerce"]
  node_app_routes["Client Routes<br/>[AppRoutes.jsx]"]
  node_product_browse["Product Browsing"]
  node_cart["Shopping Cart<br/>[useCartStore.js]"]
  node_checkout["Online Checkout<br/>[CheckoutPage.jsx]"]
  node_orders_view["Order Tracking"]
  node_client_api["API Client<br/>[axiosClient.js]"]
end

subgraph group_backend["Backend Domains"]
  node_order_api["Order API"]
  node_order_service["Order Processing"]
  node_catalog["Catalog Management<br/>[ProductService.js]"]
  node_reviews["Reviews"]
  node_review_service["Review Rules<br/>[ReviewService.js]"]
  node_review_store[("Review Records")]
  node_notification["Notifications"]
end

subgraph group_operations["Store Operations"]
  node_manager(("Manager"))
  node_admin_app["Admin Workspace<br/>[AdminApp.jsx]"]
  node_admin_orders["Order Oversight<br/>[AdminOrders.jsx]"]
  node_staff_app["Staff Workspace<br/>[StaffApp.jsx]"]
  node_barista_orders["Barista Fulfillment<br/>[BaristaOrders.jsx]"]
  node_workforce["Workforce Tools"]
end

subgraph group_platform["Platform"]
  node_api_runtime["Express API<br/>[app.js]"]
  node_database[("MySQL Connection<br/>[database.js]")]
  node_server["HTTP and Sockets<br/>[server.js]"]
  node_payos["PayOS<br/>[payos.js]"]
  node_cloudinary["Cloudinary<br/>[cloudinary.js]"]
end

node_customer(("Customer"))

node_customer -->|"opens"| node_app_routes
node_app_routes -.->|"routes to"| node_product_browse
node_product_browse -.->|"adds items"| node_cart
node_cart -.->|"checks out"| node_checkout
node_checkout -.->|"submits order"| node_client_api
node_client_api -.->|"requests"| node_order_api
node_order_api -->|"delegates"| node_order_service
node_order_service -.->|"reads and writes"| node_database
node_order_api -->|"notifies"| node_notification
node_order_api -.->|"integrates payment"| node_payos
node_client_api -.->|"loads status"| node_orders_view
node_manager -->|"manages"| node_admin_app
node_admin_app -->|"includes"| node_admin_orders
node_admin_orders -.->|"requests data"| node_client_api
node_staff_app -.->|"handles orders"| node_order_api
node_barista_orders -.->|"fulfills orders"| node_order_api
node_api_runtime -->|"served by"| node_server
node_server -->|"creates server for"| node_api_runtime
node_server -->|"loads config"| node_payos
node_api_runtime -.->|"domain data access"| node_database
node_reviews -->|"calls"| node_review_service
node_review_service -->|"queries"| node_review_store
node_reviews -->|"creates alerts"| node_notification
node_reviews -->|"uploads media"| node_cloudinary
node_workforce -.->|"persists records"| node_database

click node_app_routes "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/routes/AppRoutes.jsx"
click node_product_browse "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/product/ProductDetailPage.jsx"
click node_cart "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/store/useCartStore.js"
click node_checkout "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/order/CheckoutPage.jsx"
click node_orders_view "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/order/MyOrderOnlinePage.jsx"
click node_client_api "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/services/axiosClient.js"
click node_order_api "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/OrderOnlineController.js"
click node_order_service "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/OrderOnlineService.js"
click node_catalog "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/ProductService.js"
click node_reviews "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/ReviewController.js"
click node_review_service "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/ReviewService.js"
click node_review_store "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/repositories/ReviewRepository.js"
click node_notification "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/NotificationService.js"
click node_admin_app "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/admin/AdminApp.jsx"
click node_admin_orders "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/admin/AdminOrder/AdminOrders.jsx"
click node_staff_app "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/staff/StaffApp.jsx"
click node_barista_orders "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/barista/BaristaOrder/BaristaOrders.jsx"
click node_workforce "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/AttendanceService.js"
click node_api_runtime "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/app.js"
click node_database "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/database.js"
click node_server "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/server.js"
click node_payos "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/payos.js"
click node_cloudinary "https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/cloudinary.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_routes,node_product_browse,node_cart,node_checkout,node_orders_view,node_client_api toneBlue
class node_order_api,node_order_service,node_catalog,node_reviews,node_review_service,node_review_store,node_notification toneAmber
class node_manager,node_admin_app,node_admin_orders,node_staff_app,node_barista_orders,node_workforce toneMint
class node_api_runtime,node_database,node_server,node_payos,node_cloudinary toneRose
class node_customer toneIndigo
```

## Components

### Customer Commerce

- [Client Routes](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/routes/AppRoutes.jsx): `coffee-shop-frontend/src/routes/AppRoutes.jsx`
- [Product Browsing](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/product/ProductDetailPage.jsx): `coffee-shop-frontend/src/pages/homePage/product/ProductDetailPage.jsx`
- [Shopping Cart](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/store/useCartStore.js): `coffee-shop-frontend/src/store/useCartStore.js`
- [Online Checkout](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/order/CheckoutPage.jsx): `coffee-shop-frontend/src/pages/homePage/order/CheckoutPage.jsx`
- [Order Tracking](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/homePage/order/MyOrderOnlinePage.jsx): `coffee-shop-frontend/src/pages/homePage/order/MyOrderOnlinePage.jsx`
- [API Client](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/services/axiosClient.js): `coffee-shop-frontend/src/services/axiosClient.js`

### Backend Domains

- [Order API](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/OrderOnlineController.js): `coffee-shop-backend/src/controllers/OrderOnlineController.js`
- [Order Processing](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/OrderOnlineService.js): `coffee-shop-backend/src/services/OrderOnlineService.js`
- [Catalog Management](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/ProductService.js): `coffee-shop-backend/src/services/ProductService.js`
- [Reviews](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/controllers/ReviewController.js): `coffee-shop-backend/src/controllers/ReviewController.js`
- [Review Rules](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/ReviewService.js): `coffee-shop-backend/src/services/ReviewService.js`
- [Review Records](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/repositories/ReviewRepository.js): `coffee-shop-backend/src/repositories/ReviewRepository.js`
- [Notifications](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/NotificationService.js): `coffee-shop-backend/src/services/NotificationService.js`

### Store Operations

- **Manager**
- [Admin Workspace](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/admin/AdminApp.jsx): `coffee-shop-frontend/src/pages/admin/AdminApp.jsx`
- [Order Oversight](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/admin/AdminOrder/AdminOrders.jsx): `coffee-shop-frontend/src/pages/admin/AdminOrder/AdminOrders.jsx`
- [Staff Workspace](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/staff/StaffApp.jsx): `coffee-shop-frontend/src/pages/staff/StaffApp.jsx`
- [Barista Fulfillment](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-frontend/src/pages/barista/BaristaOrder/BaristaOrders.jsx): `coffee-shop-frontend/src/pages/barista/BaristaOrder/BaristaOrders.jsx`
- [Workforce Tools](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/services/AttendanceService.js): `coffee-shop-backend/src/services/AttendanceService.js`

### Platform

- [Express API](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/app.js): `coffee-shop-backend/src/app.js`
- [MySQL Connection](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/database.js): `coffee-shop-backend/src/config/database.js`
- [HTTP and Sockets](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/server.js): `coffee-shop-backend/server.js`
- [PayOS](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/payos.js): `coffee-shop-backend/src/config/payos.js`
- [Cloudinary](https://github.com/fuhl-sp26-sep490-g13/coffee-shop/blob/main/coffee-shop-backend/src/config/cloudinary.js): `coffee-shop-backend/src/config/cloudinary.js`

### Other components

- **Customer**

## Connections

- Customer → Client Routes: opens (evidence: `coffee-shop-frontend/src/routes/AppRoutes.jsx`)
- Client Routes → Product Browsing: routes to (evidence: `coffee-shop-frontend/src/routes/AppRoutes.jsx`)
- Product Browsing → Shopping Cart: adds items
- Shopping Cart → Online Checkout: checks out
- Online Checkout → API Client: submits order
- API Client → Order API: requests
- Order API → Order Processing: delegates (evidence: `coffee-shop-backend/src/controllers/OrderOnlineController.js`)
- Order Processing → MySQL Connection: reads and writes
- Order API → Notifications: notifies (evidence: `coffee-shop-backend/src/controllers/OrderOnlineController.js`)
- Order API → PayOS: integrates payment
- API Client → Order Tracking: loads status
- Manager → Admin Workspace: manages
- Admin Workspace → Order Oversight: includes (evidence: `coffee-shop-frontend/src/routes/AppRoutes.jsx`)
- Order Oversight → API Client: requests data
- Staff Workspace → Order API: handles orders
- Barista Fulfillment → Order API: fulfills orders
- Express API → HTTP and Sockets: served by (evidence: `coffee-shop-backend/server.js`)
- HTTP and Sockets → Express API: creates server for (evidence: `coffee-shop-backend/server.js`)
- HTTP and Sockets → PayOS: loads config (evidence: `coffee-shop-backend/server.js`)
- Express API → MySQL Connection: domain data access
- Reviews → Review Rules: calls (evidence: `coffee-shop-backend/src/controllers/ReviewController.js`)
- Review Rules → Review Records: queries (evidence: `coffee-shop-backend/src/services/ReviewService.js`)
- Reviews → Notifications: creates alerts (evidence: `coffee-shop-backend/src/controllers/ReviewController.js`)
- Reviews → Cloudinary: uploads media (evidence: `coffee-shop-backend/src/controllers/ReviewController.js`)
- Workforce Tools → MySQL Connection: persists records
