# panhakoeun142007-creator/prey-lang-coffee-pos-system architecture

> Architecture diagram of the GitHub repository panhakoeun142007-creator/prey-lang-coffee-pos-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/panhakoeun142007-creator/prey-lang-coffee-pos-system
- Repository: https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system

## Overview

Prey Lang Coffee POS is a restaurant point-of-sale system with staff operations and a customer-facing ordering experience. Staff use the React application to manage orders, products, tables, stock, finances, receipts, and analytics; customers can browse a menu and place orders. The Laravel API routes requests to domain controllers, with order creation and status changes delegated to an order service and persisted through Eloquent models. The README confirms the React-to-Laravel API connection and MySQL persistence. Several capabilities are documented by the route and frontend indexes but their detailed runtime wiring was not sampled.

Main entry points: [`backend/routes/api.php`](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/routes/api.php) (API routes), [`frontend/src/services/api.ts`](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/services/api.ts) (API client), [`backend/app/Http/Controllers/Api/OrderController.php`](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/OrderController.php) (Order API), [`backend/app/Services/OrderService.php`](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Services/OrderService.php) (Order service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS interfaces"]
  node_spa["POS application<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_customer_menu["Customer menu"]
  node_orders_ui["Order management<br/>[LiveOrders.tsx]"]
  node_catalog_ui["Catalog management<br/>[Products.tsx]"]
  node_stock_ui["Stock management"]
  node_reports_ui["POS reporting<br/>[DashboardPage.tsx]"]
  node_finance_ui["Finance and receipts<br/>[FinancePage.tsx]"]
end

subgraph group_api["API and access"]
  node_api_routes["API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_settings["Application settings<br/>[AppSettings.php]"]
end

subgraph group_orders["Order operations"]
  node_order_controller["Order API"]
  node_order_service["Order service<br/>[OrderService.php]"]
  node_order_model[("Orders<br/>[Order.php]")]
  node_tables[("Dining tables<br/>[DiningTable.php]")]
end

subgraph group_catalog["Catalog and stock"]
  node_product_controller["Product API"]
  node_products[("Products<br/>[Product.php]")]
  node_recipes["Recipes"]
  node_stock_api["Ingredient stock"]
end

subgraph group_business["Business reporting"]
  node_dashboard["Dashboard analytics"]
  node_finance_api["Finance and expenses"]
  node_receipts["Receipt API"]
  node_sales_analytics["Sales analytics"]
end

node_staff(("POS staff"))
node_customer(("Customer"))
node_mysql[("MySQL database")]

node_staff -->|"uses"| node_spa
node_customer -.->|"browses and orders"| node_customer_menu
node_spa -->|"requests data"| node_api_client
node_customer_menu -.->|"requests data"| node_api_client
node_api_client -->|"sends API requests"| node_api_routes
node_api_routes -->|"routes auth"| node_auth
node_api_routes -->|"routes orders"| node_order_controller
node_api_routes -->|"routes products"| node_product_controller
node_api_routes -->|"routes stock"| node_stock_api
node_api_routes -->|"routes dashboard"| node_dashboard
node_api_routes -->|"routes finance"| node_finance_api
node_api_routes -->|"routes receipts"| node_receipts
node_api_routes -->|"routes analytics"| node_sales_analytics
node_orders_ui -->|"fetches and updates"| node_api_client
node_catalog_ui -->|"fetches and updates"| node_api_client
node_stock_ui -.->|"fetches and updates"| node_api_client
node_reports_ui -.->|"fetches data"| node_api_client
node_finance_ui -.->|"fetches data"| node_api_client
node_order_controller -->|"delegates order logic"| node_order_service
node_order_service -->|"creates and updates"| node_order_model
node_order_controller -->|"queries and deletes"| node_order_model
node_order_service -->|"resolves table"| node_tables
node_order_controller -->|"reads payment options"| node_settings
node_order_service -->|"reads product prices"| node_products
node_product_controller -->|"manages products"| node_products
node_product_controller -.->|"persists product data"| node_mysql
node_order_model -.->|"persists orders"| node_mysql
node_dashboard -.->|"queries business data"| node_mysql
node_finance_api -.->|"reads financial records"| node_mysql
node_receipts -->|"reads receipt orders"| node_order_model
node_recipes -->|"uses products"| node_products
node_stock_api -.->|"manages stock records"| node_mysql
node_sales_analytics -.->|"queries sales data"| node_mysql

click node_spa "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/services/api.ts"
click node_customer_menu "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/CustomerMenuApp.jsx"
click node_api_routes "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/routes/api.php"
click node_auth "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/AuthController.php"
click node_orders_ui "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/LiveOrders.tsx"
click node_catalog_ui "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/Products.tsx"
click node_stock_ui "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/IngredientsStockPage.tsx"
click node_reports_ui "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_finance_ui "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/FinancePage.tsx"
click node_order_controller "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/OrderController.php"
click node_order_service "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Services/OrderService.php"
click node_order_model "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/Order.php"
click node_tables "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/DiningTable.php"
click node_product_controller "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/ProductController.php"
click node_products "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/Product.php"
click node_recipes "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/RecipeController.php"
click node_stock_api "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/IngredientController.php"
click node_dashboard "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/DashboardController.php"
click node_finance_api "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/FinanceController.php"
click node_receipts "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/ReceiptController.php"
click node_sales_analytics "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/SalesAnalyticsController.php"
click node_settings "https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Support/AppSettings.php"

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_spa,node_api_client,node_customer_menu,node_orders_ui,node_catalog_ui,node_stock_ui,node_reports_ui,node_finance_ui toneBlue
class node_api_routes,node_auth,node_settings,node_mysql toneAmber
class node_order_controller,node_order_service,node_order_model,node_tables toneMint
class node_product_controller,node_products,node_recipes,node_stock_api toneRose
class node_dashboard,node_finance_api,node_receipts,node_sales_analytics,node_staff,node_customer toneIndigo
```

## Components

### POS interfaces

- [POS application](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Customer menu](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/CustomerMenuApp.jsx): `frontend/src/pages/CustomerMenuApp.jsx`
- [Order management](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/LiveOrders.tsx): `frontend/src/pages/LiveOrders.tsx`
- [Catalog management](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/Products.tsx): `frontend/src/pages/Products.tsx`
- [Stock management](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/IngredientsStockPage.tsx): `frontend/src/pages/IngredientsStockPage.tsx`
- [POS reporting](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Finance and receipts](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/frontend/src/pages/FinancePage.tsx): `frontend/src/pages/FinancePage.tsx`

### API and access

- [API routes](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Authentication](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/AuthController.php): `backend/app/Http/Controllers/Api/AuthController.php`
- [Application settings](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Support/AppSettings.php): `backend/app/Support/AppSettings.php`

### Order operations

- [Order API](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/OrderController.php): `backend/app/Http/Controllers/Api/OrderController.php`
- [Order service](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Services/OrderService.php): `backend/app/Services/OrderService.php`
- [Orders](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/Order.php): `backend/app/Models/Order.php`
- [Dining tables](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/DiningTable.php): `backend/app/Models/DiningTable.php`

### Catalog and stock

- [Product API](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/ProductController.php): `backend/app/Http/Controllers/Api/ProductController.php`
- [Products](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Models/Product.php): `backend/app/Models/Product.php`
- [Recipes](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/RecipeController.php): `backend/app/Http/Controllers/Api/RecipeController.php`
- [Ingredient stock](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/IngredientController.php): `backend/app/Http/Controllers/Api/IngredientController.php`

### Business reporting

- [Dashboard analytics](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/DashboardController.php): `backend/app/Http/Controllers/Api/DashboardController.php`
- [Finance and expenses](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/FinanceController.php): `backend/app/Http/Controllers/Api/FinanceController.php`
- [Receipt API](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/ReceiptController.php): `backend/app/Http/Controllers/Api/ReceiptController.php`
- [Sales analytics](https://github.com/panhakoeun142007-creator/prey-lang-coffee-pos-system/blob/main/backend/app/Http/Controllers/Api/SalesAnalyticsController.php): `backend/app/Http/Controllers/Api/SalesAnalyticsController.php`

### Other components

- **POS staff**
- **Customer**
- **MySQL database**

## Connections

- POS staff → POS application: uses (evidence: `frontend/src/App.jsx`)
- Customer → Customer menu: browses and orders
- POS application → API client: requests data (evidence: `frontend/src/App.jsx`)
- Customer menu → API client: requests data
- API client → API routes: sends API requests
- API routes → Authentication: routes auth (evidence: `backend/routes/api.php`)
- API routes → Order API: routes orders (evidence: `backend/routes/api.php`)
- API routes → Product API: routes products (evidence: `backend/routes/api.php`)
- API routes → Ingredient stock: routes stock (evidence: `backend/routes/api.php`)
- API routes → Dashboard analytics: routes dashboard (evidence: `backend/routes/api.php`)
- API routes → Finance and expenses: routes finance (evidence: `backend/routes/api.php`)
- API routes → Receipt API: routes receipts (evidence: `backend/routes/api.php`)
- API routes → Sales analytics: routes analytics (evidence: `backend/routes/api.php`)
- Order management → API client: fetches and updates (evidence: `frontend/src/App.jsx`)
- Catalog management → API client: fetches and updates (evidence: `frontend/src/App.jsx`)
- Stock management → API client: fetches and updates
- POS reporting → API client: fetches data
- Finance and receipts → API client: fetches data
- Order API → Order service: delegates order logic (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- Order service → Orders: creates and updates (evidence: `backend/app/Services/OrderService.php`)
- Order API → Orders: queries and deletes (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- Order service → Dining tables: resolves table (evidence: `backend/app/Services/OrderService.php`)
- Order API → Application settings: reads payment options (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- Order service → Products: reads product prices (evidence: `backend/app/Services/OrderService.php`)
- Product API → Products: manages products (evidence: `backend/app/Http/Controllers/Api/ProductController.php`)
- Product API → MySQL database: persists product data
- Orders → MySQL database: persists orders
- Dashboard analytics → MySQL database: queries business data
- Finance and expenses → MySQL database: reads financial records
- Receipt API → Orders: reads receipt orders (evidence: `backend/app/Http/Controllers/Api/ReceiptController.php`)
- Recipes → Products: uses products (evidence: `backend/app/Http/Controllers/Api/RecipeController.php`)
- Ingredient stock → MySQL database: manages stock records
- Sales analytics → MySQL database: queries sales data
