# osmantaher/saraya-client architecture

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

- Interactive diagram: https://gitdiagram.com/osmantaher/saraya-client
- Repository: https://github.com/osmantaher/saraya-client

## Overview

This is a restaurant ordering storefront with an admin back office and cashier flow. Customers browse menu items, build a cart, submit checkout, and can track orders; staff authenticate, manage products and orders, review summaries, and create in-person cashier orders. The map includes the shared cart and category layer plus menu, checkout, and administration stages. API services are external because their implementation is not in this repository; the README is empty, so broader capability connections rely on the sampled pages and source index.

Main entry points: [`src/app/admin/cashier/page.tsx`](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/cashier/page.tsx) (Cashier page), [`src/app/page.tsx`](https://github.com/osmantaher/saraya-client/blob/main/src/app/page.tsx) (Menu page), [`src/components/cart/CheckoutForm.tsx`](https://github.com/osmantaher/saraya-client/blob/main/src/components/cart/CheckoutForm.tsx) (Checkout), [`src/app/admin/products/page.tsx`](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/products/page.tsx) (Product management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_home["Menu page<br/>[page.tsx]"]
  node_product["Product card<br/>[ProductCard.tsx]"]
  node_quick["Quick services"]
  node_tracking["Order tracking"]
end

subgraph group_order["Cart and ordering"]
  node_cart["Cart state<br/>[CartContext.tsx]"]
  node_checkout["Checkout<br/>[CheckoutForm.tsx]"]
  node_customerinfo["Customer details"]
end

subgraph group_admin["Admin operations"]
  node_login["Admin login<br/>[page.tsx]"]
  node_products["Product management<br/>[page.tsx]"]
  node_productform["Product editor<br/>[ProductForm.tsx]"]
  node_producttable["Product table<br/>[ProductsTable.tsx]"]
  node_orders["Order management<br/>[page.tsx]"]
  node_ordercard["Order card<br/>[OrderCard.tsx]"]
  node_summary["Order summaries<br/>[page.tsx]"]
  node_cashier["Cashier page<br/>[page.tsx]"]
  node_cashiercart["Cashier cart panel"]
  node_watcher["Cashier order watcher"]
  node_receipt["Thermal receipt"]
end

subgraph group_shared["Shared runtime"]
  node_authcookie["Admin token cookies<br/>[cookies.ts]"]
  node_categories["Menu categories<br/>[categories.ts]"]
end

node_customer(("Customer"))
node_staff(("Staff"))
node_api{{"Restaurant API"}}

node_customer -->|"browses"| node_home
node_home -->|"fetches menu"| node_api
node_home -->|"renders"| node_product
node_home -->|"renders"| node_checkout
node_home -->|"renders"| node_quick
node_home -->|"uses categories"| node_categories
node_product -->|"adds items"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"renders"| node_customerinfo
node_checkout -.->|"submits order"| node_api
node_quick -->|"tracks order"| node_api
node_quick -->|"opens details"| node_tracking
node_staff -->|"authenticates"| node_login
node_login -->|"requests login"| node_api
node_login -->|"stores token"| node_authcookie
node_products -->|"manages products"| node_api
node_products -->|"reads token"| node_authcookie
node_products -->|"renders table"| node_producttable
node_producttable -->|"opens editor"| node_productform
node_orders -->|"loads and updates"| node_api
node_orders -->|"reads token"| node_authcookie
node_orders -->|"renders cards"| node_ordercard
node_summary -.->|"loads summaries"| node_api
node_cashier -->|"loads products"| node_api
node_cashier -->|"creates cashier order"| node_api
node_cashier -->|"renders panel"| node_cashiercart
node_cashier -->|"renders watcher"| node_watcher
node_cashier -->|"renders receipt"| node_receipt
node_cashier -->|"uses categories"| node_categories
node_cashiercart -->|"uses shared cart"| node_cart
node_watcher -.->|"checks orders"| node_api

click node_home "https://github.com/osmantaher/saraya-client/blob/main/src/app/page.tsx"
click node_product "https://github.com/osmantaher/saraya-client/blob/main/src/components/product/ProductCard.tsx"
click node_quick "https://github.com/osmantaher/saraya-client/blob/main/src/components/home/QuickServicesBar.tsx"
click node_cart "https://github.com/osmantaher/saraya-client/blob/main/src/context/CartContext.tsx"
click node_checkout "https://github.com/osmantaher/saraya-client/blob/main/src/components/cart/CheckoutForm.tsx"
click node_customerinfo "https://github.com/osmantaher/saraya-client/blob/main/src/components/cart/CustomerInfoForm.tsx"
click node_tracking "https://github.com/osmantaher/saraya-client/blob/main/src/components/home/OrderQuickViewModal.tsx"
click node_login "https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/page.tsx"
click node_authcookie "https://github.com/osmantaher/saraya-client/blob/main/src/lib/cookies.ts"
click node_products "https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/products/page.tsx"
click node_productform "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/products/ProductForm.tsx"
click node_producttable "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/products/ProductsTable.tsx"
click node_orders "https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/orders/page.tsx"
click node_ordercard "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/orders/OrderCard.tsx"
click node_summary "https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/orders-summary/page.tsx"
click node_cashier "https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/cashier/page.tsx"
click node_cashiercart "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierCartPanel.tsx"
click node_watcher "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierOrderWatcher.tsx"
click node_receipt "https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierThermalReceipt.tsx"
click node_categories "https://github.com/osmantaher/saraya-client/blob/main/src/constants/categories.ts"

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_home,node_product,node_quick,node_tracking toneBlue
class node_cart,node_checkout,node_customerinfo toneAmber
class node_login,node_products,node_productform,node_producttable,node_orders,node_ordercard,node_summary,node_cashier,node_cashiercart,node_watcher,node_receipt,node_api toneMint
class node_authcookie,node_categories toneRose
class node_customer,node_staff toneIndigo
```

## Components

### Customer storefront

- [Menu page](https://github.com/osmantaher/saraya-client/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Product card](https://github.com/osmantaher/saraya-client/blob/main/src/components/product/ProductCard.tsx): `src/components/product/ProductCard.tsx`
- [Quick services](https://github.com/osmantaher/saraya-client/blob/main/src/components/home/QuickServicesBar.tsx): `src/components/home/QuickServicesBar.tsx`
- [Order tracking](https://github.com/osmantaher/saraya-client/blob/main/src/components/home/OrderQuickViewModal.tsx): `src/components/home/OrderQuickViewModal.tsx`

### Cart and ordering

- [Cart state](https://github.com/osmantaher/saraya-client/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`
- [Checkout](https://github.com/osmantaher/saraya-client/blob/main/src/components/cart/CheckoutForm.tsx): `src/components/cart/CheckoutForm.tsx`
- [Customer details](https://github.com/osmantaher/saraya-client/blob/main/src/components/cart/CustomerInfoForm.tsx): `src/components/cart/CustomerInfoForm.tsx`

### Admin operations

- [Admin login](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Product management](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/products/page.tsx): `src/app/admin/products/page.tsx`
- [Product editor](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/products/ProductForm.tsx): `src/components/admin/products/ProductForm.tsx`
- [Product table](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/products/ProductsTable.tsx): `src/components/admin/products/ProductsTable.tsx`
- [Order management](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/orders/page.tsx): `src/app/admin/orders/page.tsx`
- [Order card](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/orders/OrderCard.tsx): `src/components/admin/orders/OrderCard.tsx`
- [Order summaries](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/orders-summary/page.tsx): `src/app/admin/orders-summary/page.tsx`
- [Cashier page](https://github.com/osmantaher/saraya-client/blob/main/src/app/admin/cashier/page.tsx): `src/app/admin/cashier/page.tsx`
- [Cashier cart panel](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierCartPanel.tsx): `src/components/admin/cashier/CashierCartPanel.tsx`
- [Cashier order watcher](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierOrderWatcher.tsx): `src/components/admin/cashier/CashierOrderWatcher.tsx`
- [Thermal receipt](https://github.com/osmantaher/saraya-client/blob/main/src/components/admin/cashier/CashierThermalReceipt.tsx): `src/components/admin/cashier/CashierThermalReceipt.tsx`

### Shared runtime

- [Admin token cookies](https://github.com/osmantaher/saraya-client/blob/main/src/lib/cookies.ts): `src/lib/cookies.ts`
- [Menu categories](https://github.com/osmantaher/saraya-client/blob/main/src/constants/categories.ts): `src/constants/categories.ts`

### Other components

- **Customer**
- **Staff**
- **Restaurant API**

## Connections

- Customer → Menu page: browses (evidence: `src/app/page.tsx`)
- Menu page → Restaurant API: fetches menu (evidence: `src/app/page.tsx`)
- Menu page → Product card: renders (evidence: `src/app/page.tsx`)
- Menu page → Checkout: renders (evidence: `src/app/page.tsx`)
- Menu page → Quick services: renders (evidence: `src/app/page.tsx`)
- Menu page → Menu categories: uses categories (evidence: `src/app/page.tsx`)
- Product card → Cart state: adds items (evidence: `src/components/product/ProductCard.tsx`)
- Checkout → Cart state: reads cart (evidence: `src/components/cart/CheckoutForm.tsx`)
- Checkout → Customer details: renders (evidence: `src/components/cart/CheckoutForm.tsx`)
- Checkout → Restaurant API: submits order
- Quick services → Restaurant API: tracks order (evidence: `src/components/home/QuickServicesBar.tsx`)
- Quick services → Order tracking: opens details (evidence: `src/components/home/QuickServicesBar.tsx`)
- Staff → Admin login: authenticates (evidence: `src/app/admin/page.tsx`)
- Admin login → Restaurant API: requests login (evidence: `src/app/admin/page.tsx`)
- Admin login → Admin token cookies: stores token (evidence: `src/app/admin/page.tsx`)
- Product management → Restaurant API: manages products (evidence: `src/app/admin/products/page.tsx`)
- Product management → Admin token cookies: reads token (evidence: `src/app/admin/products/page.tsx`)
- Product management → Product table: renders table (evidence: `src/app/admin/products/page.tsx`)
- Product table → Product editor: opens editor
- Order management → Restaurant API: loads and updates (evidence: `src/app/admin/orders/page.tsx`)
- Order management → Admin token cookies: reads token (evidence: `src/app/admin/orders/page.tsx`)
- Order management → Order card: renders cards (evidence: `src/app/admin/orders/page.tsx`)
- Order summaries → Restaurant API: loads summaries
- Cashier page → Restaurant API: loads products (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier page → Restaurant API: creates cashier order (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier page → Cashier cart panel: renders panel (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier page → Cashier order watcher: renders watcher (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier page → Thermal receipt: renders receipt (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier page → Menu categories: uses categories (evidence: `src/app/admin/cashier/page.tsx`)
- Cashier cart panel → Cart state: uses shared cart (evidence: `src/components/admin/cashier/CashierCartPanel.tsx`)
- Cashier order watcher → Restaurant API: checks orders
