# azeltdz/capstone architecture

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

- Interactive diagram: https://gitdiagram.com/azeltdz/capstone
- Repository: https://github.com/azeltdz/capstone

## Overview

This is a multi-branch restaurant operations platform: cashiers use point-of-sale, table, and order screens, while owners manage branches, menu and recipes, inventory, staff, transactions, settings, and analytics. The React app calls a shared API client; an Express server mounts domain routes that lead to controllers and data models. The graph preserves documented product areas, but most frontend-to-endpoint wiring and several backend domain implementations were not excerpted, so those connections are omitted rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/azeltdz/capstone/blob/main/frontend/src/App.jsx) (App routing), [`backend/src/routes`](https://github.com/azeltdz/capstone/tree/main/backend/src/routes) (Domain routes), [`backend/src/routes/branchRoutes.js`](https://github.com/azeltdz/capstone/blob/main/backend/src/routes/branchRoutes.js) (Branch routes), [`backend/src/routes/inventoryRoutes.js`](https://github.com/azeltdz/capstone/blob/main/backend/src/routes/inventoryRoutes.js) (Inventory routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Sign-in<br/>[LoginPage.jsx]"]
  node_auth["Auth context<br/>[AuthContext.jsx]"]
  node_client["API client<br/>[client.js]"]
end

subgraph group_cashier["Cashier operations"]
  node_cashier_views["POS, tables, orders"]
end

subgraph group_owner["Owner operations"]
  node_owner_views["Owner workspace"]
  node_analytics_view["AI analytics"]
end

subgraph group_backend["Backend API"]
  node_api_routes["Domain routes"]
  node_branch_routes["Branch routes<br/>[branchRoutes.js]"]
  node_inventory_routes["Inventory routes<br/>[inventoryRoutes.js]"]
  node_menu_routes["Menu and recipe routes<br/>[menuRoutes.js]"]
  node_branch_controller["Branch management"]
  node_inventory_controller["Inventory operations"]
  node_transaction_controller["Transaction reporting"]
  node_auth_middleware["Authentication<br/>[authMiddleware.js]"]
  node_role_middleware["Role authorization<br/>[roleMiddleware.js]"]
  node_analytics["Analytics services"]
end

subgraph group_data["Domain data"]
  node_branch_model[("Branch data<br/>[branchModel.js]")]
  node_inventory_model[("Inventory data<br/>[inventoryModel.js]")]
  node_transaction_model[("Transaction data")]
  node_other_models[("Other domain models")]
end

node_cashier(("Cashier"))
node_owner(("Owner"))

node_cashier -->|"uses"| node_app
node_owner -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_cashier_views
node_app -->|"routes to"| node_owner_views
node_app -->|"routes to"| node_analytics_view
node_auth -->|"uses"| node_client
node_app -->|"mounts"| node_api_routes
node_api_routes -->|"includes"| node_branch_routes
node_api_routes -->|"includes"| node_inventory_routes
node_api_routes -->|"includes"| node_menu_routes
node_branch_routes -->|"dispatches to"| node_branch_controller
node_inventory_routes -->|"dispatches to"| node_inventory_controller
node_menu_routes -.->|"routes menu and BOM"| node_other_models
node_inventory_controller -->|"reads branch"| node_branch_model
node_inventory_controller -->|"reads and writes"| node_inventory_model
node_branch_controller -->|"reads and writes"| node_branch_model
node_transaction_controller -->|"queries"| node_transaction_model
node_transaction_controller -->|"reads branches"| node_branch_model
node_branch_controller -->|"gets pace stats"| node_analytics
node_branch_routes -->|"protects routes"| node_auth_middleware
node_branch_routes -->|"guards owner actions"| node_role_middleware
node_inventory_routes -->|"protects routes"| node_auth_middleware
node_inventory_routes -->|"guards owner actions"| node_role_middleware

click node_app "https://github.com/azeltdz/capstone/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/azeltdz/capstone/blob/main/frontend/src/pages/LoginPage.jsx"
click node_auth "https://github.com/azeltdz/capstone/blob/main/frontend/src/context/AuthContext.jsx"
click node_cashier_views "https://github.com/azeltdz/capstone/tree/main/frontend/src/pages/cashier"
click node_owner_views "https://github.com/azeltdz/capstone/tree/main/frontend/src/pages/owner"
click node_analytics_view "https://github.com/azeltdz/capstone/blob/main/frontend/src/pages/owner/AIAnalyticsView.jsx"
click node_client "https://github.com/azeltdz/capstone/blob/main/frontend/src/api/client.js"
click node_api_routes "https://github.com/azeltdz/capstone/tree/main/backend/src/routes"
click node_branch_routes "https://github.com/azeltdz/capstone/blob/main/backend/src/routes/branchRoutes.js"
click node_inventory_routes "https://github.com/azeltdz/capstone/blob/main/backend/src/routes/inventoryRoutes.js"
click node_menu_routes "https://github.com/azeltdz/capstone/blob/main/backend/src/routes/menuRoutes.js"
click node_branch_controller "https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/branchController.js"
click node_inventory_controller "https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/inventoryController.js"
click node_transaction_controller "https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/transactionController.js"
click node_auth_middleware "https://github.com/azeltdz/capstone/blob/main/backend/src/middleware/authMiddleware.js"
click node_role_middleware "https://github.com/azeltdz/capstone/blob/main/backend/src/middleware/roleMiddleware.js"
click node_branch_model "https://github.com/azeltdz/capstone/blob/main/backend/src/models/branchModel.js"
click node_inventory_model "https://github.com/azeltdz/capstone/blob/main/backend/src/models/inventoryModel.js"
click node_transaction_model "https://github.com/azeltdz/capstone/blob/main/backend/src/models/transactionModel.js"
click node_other_models "https://github.com/azeltdz/capstone/tree/main/backend/src/models"
click node_analytics "https://github.com/azeltdz/capstone/blob/main/backend/src/services/analyticsService.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_login,node_auth,node_client toneBlue
class node_cashier_views toneAmber
class node_owner_views,node_analytics_view toneMint
class node_api_routes,node_branch_routes,node_inventory_routes,node_menu_routes,node_branch_controller,node_inventory_controller,node_transaction_controller,node_auth_middleware,node_role_middleware,node_analytics toneRose
class node_branch_model,node_inventory_model,node_transaction_model,node_other_models,node_cashier,node_owner toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/azeltdz/capstone/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in](https://github.com/azeltdz/capstone/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Auth context](https://github.com/azeltdz/capstone/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/azeltdz/capstone/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### Cashier operations

- [POS, tables, orders](https://github.com/azeltdz/capstone/tree/main/frontend/src/pages/cashier): `frontend/src/pages/cashier`

### Owner operations

- [Owner workspace](https://github.com/azeltdz/capstone/tree/main/frontend/src/pages/owner): `frontend/src/pages/owner`
- [AI analytics](https://github.com/azeltdz/capstone/blob/main/frontend/src/pages/owner/AIAnalyticsView.jsx): `frontend/src/pages/owner/AIAnalyticsView.jsx`

### Backend API

- [Domain routes](https://github.com/azeltdz/capstone/tree/main/backend/src/routes): `backend/src/routes`
- [Branch routes](https://github.com/azeltdz/capstone/blob/main/backend/src/routes/branchRoutes.js): `backend/src/routes/branchRoutes.js`
- [Inventory routes](https://github.com/azeltdz/capstone/blob/main/backend/src/routes/inventoryRoutes.js): `backend/src/routes/inventoryRoutes.js`
- [Menu and recipe routes](https://github.com/azeltdz/capstone/blob/main/backend/src/routes/menuRoutes.js): `backend/src/routes/menuRoutes.js`
- [Branch management](https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/branchController.js): `backend/src/controllers/branchController.js`
- [Inventory operations](https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/inventoryController.js): `backend/src/controllers/inventoryController.js`
- [Transaction reporting](https://github.com/azeltdz/capstone/blob/main/backend/src/controllers/transactionController.js): `backend/src/controllers/transactionController.js`
- [Authentication](https://github.com/azeltdz/capstone/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Role authorization](https://github.com/azeltdz/capstone/blob/main/backend/src/middleware/roleMiddleware.js): `backend/src/middleware/roleMiddleware.js`
- [Analytics services](https://github.com/azeltdz/capstone/blob/main/backend/src/services/analyticsService.js): `backend/src/services/analyticsService.js`

### Domain data

- [Branch data](https://github.com/azeltdz/capstone/blob/main/backend/src/models/branchModel.js): `backend/src/models/branchModel.js`
- [Inventory data](https://github.com/azeltdz/capstone/blob/main/backend/src/models/inventoryModel.js): `backend/src/models/inventoryModel.js`
- [Transaction data](https://github.com/azeltdz/capstone/blob/main/backend/src/models/transactionModel.js): `backend/src/models/transactionModel.js`
- [Other domain models](https://github.com/azeltdz/capstone/tree/main/backend/src/models): `backend/src/models`

### Other components

- **Cashier**
- **Owner**

## Connections

- Cashier → App routing: uses (evidence: `frontend/src/App.jsx`)
- Owner → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Sign-in: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Auth context: provides auth (evidence: `frontend/src/App.jsx`)
- App routing → POS, tables, orders: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Owner workspace: routes to (evidence: `frontend/src/App.jsx`)
- App routing → AI analytics: routes to (evidence: `frontend/src/App.jsx`)
- Auth context → API client: uses (evidence: `frontend/src/context/AuthContext.jsx`)
- App routing → Domain routes: mounts
- Domain routes → Branch routes: includes (evidence: `backend/app.js`)
- Domain routes → Inventory routes: includes (evidence: `backend/app.js`)
- Domain routes → Menu and recipe routes: includes (evidence: `backend/app.js`)
- Branch routes → Branch management: dispatches to (evidence: `backend/src/routes/branchRoutes.js`)
- Inventory routes → Inventory operations: dispatches to (evidence: `backend/src/routes/inventoryRoutes.js`)
- Menu and recipe routes → Other domain models: routes menu and BOM
- Inventory operations → Branch data: reads branch (evidence: `backend/src/controllers/inventoryController.js`)
- Inventory operations → Inventory data: reads and writes (evidence: `backend/src/controllers/inventoryController.js`)
- Branch management → Branch data: reads and writes (evidence: `backend/src/controllers/branchController.js`)
- Transaction reporting → Transaction data: queries (evidence: `backend/src/controllers/transactionController.js`)
- Transaction reporting → Branch data: reads branches (evidence: `backend/src/controllers/transactionController.js`)
- Branch management → Analytics services: gets pace stats (evidence: `backend/src/controllers/branchController.js`)
- Branch routes → Authentication: protects routes (evidence: `backend/src/routes/branchRoutes.js`)
- Branch routes → Role authorization: guards owner actions (evidence: `backend/src/routes/branchRoutes.js`)
- Inventory routes → Authentication: protects routes (evidence: `backend/src/routes/inventoryRoutes.js`)
- Inventory routes → Role authorization: guards owner actions (evidence: `backend/src/routes/inventoryRoutes.js`)
