# terboubomar/talab architecture

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

## Overview

Talab is a restaurant ordering and operations platform: customers select a branch and order type, browse a menu, build a cart, and check out; staff manage branches, catalog, orders, payments, and reporting. A separate driver app supports delivery work. The graph also preserves the documented-in-tree integration workspaces and serverless functions. Relationship evidence is limited to the README and SOURCE INDEX references; unsampled modules are represented by their exact paths, but uncertain links are omitted.

Main entry points: [`src/lib/storefront.ts`](https://github.com/terboubomar/talab/blob/main/src/lib/storefront.ts) (Storefront data), [`src/routes/checkout.tsx`](https://github.com/terboubomar/talab/blob/main/src/routes/checkout.tsx) (Checkout), [`src/routes/_staffShell.admin.orders.tsx`](https://github.com/terboubomar/talab/blob/main/src/routes/_staffShell.admin.orders.tsx) (Admin routes), [`src/routes/index.tsx`](https://github.com/terboubomar/talab/blob/main/src/routes/index.tsx) (Storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer ordering"]
  node_storefront["Storefront<br/>[index.tsx]"]
  node_menu["Menu browsing<br/>[menu.tsx]"]
  node_cart["Cart state<br/>[cart.ts]"]
  node_checkout["Checkout<br/>[checkout.tsx]"]
  node_paymentform["Payment form"]
  node_customeraccount["Customer account<br/>[account.tsx]"]
end

subgraph group_admin["Staff operations"]
  node_adminroutes["Admin routes"]
  node_branchops["Branch operations"]
  node_catalogadmin["Catalog management<br/>[catalog.ts]"]
  node_orderops["Order operations<br/>[order-detail.ts]"]
  node_reports["Reports<br/>[report-center.ts]"]
  node_marketing["Marketing tools"]
end

subgraph group_platform["Shared platform"]
  node_router["Application router<br/>[router.tsx]"]
  node_storefrontdata["Storefront data<br/>[storefront.ts]"]
  node_menudata["Menu data<br/>[menu.ts]"]
  node_databaseclient["Supabase client<br/>[supabase.ts]"]
  node_database[("Supabase database")]
end

subgraph group_integrations["Integrations"]
  node_paymentfunctions["Payment functions<br/>[index.ts]"]
  node_foodics["Foodics functions<br/>[index.ts]"]
  node_loyverseworkspace["Loyverse workspace"]
end

subgraph group_driver["Driver app"]
  node_driverapp["Driver app<br/>[App.tsx]"]
  node_driverapi["Driver API<br/>[api.ts]"]
  node_driversupabase["Driver Supabase<br/>[supabase.ts]"]
end

node_customer(("Customer"))

node_customer -->|"opens"| node_storefront
node_router -->|"routes to"| node_storefront
node_router -->|"routes to"| node_adminroutes
node_storefront -.->|"loads context"| node_storefrontdata
node_menu -.->|"loads menu"| node_menudata
node_checkout -->|"reads selection"| node_storefrontdata
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"formats items"| node_menudata
node_checkout -->|"renders"| node_paymentform
node_customeraccount -.->|"uses data"| node_storefrontdata
node_adminroutes -->|"uses operations"| node_branchops
node_adminroutes -->|"loads reports"| node_reports
node_adminroutes -->|"routes to"| node_marketing
node_marketing -.->|"uses settings"| node_storefrontdata
node_storefrontdata -->|"queries"| node_databaseclient
node_menudata -->|"queries"| node_databaseclient
node_databaseclient -->|"connects"| node_database
node_driverapp -->|"requests data"| node_driverapi
node_driverapi -->|"uses client"| node_driversupabase

click node_storefront "https://github.com/terboubomar/talab/blob/main/src/routes/index.tsx"
click node_menu "https://github.com/terboubomar/talab/blob/main/src/routes/menu.tsx"
click node_cart "https://github.com/terboubomar/talab/blob/main/src/lib/cart.ts"
click node_checkout "https://github.com/terboubomar/talab/blob/main/src/routes/checkout.tsx"
click node_paymentform "https://github.com/terboubomar/talab/blob/main/src/components/moyasar-payment-form.tsx"
click node_customeraccount "https://github.com/terboubomar/talab/blob/main/src/routes/account.tsx"
click node_adminroutes "https://github.com/terboubomar/talab/blob/main/src/routes/_staffShell.admin.orders.tsx"
click node_branchops "https://github.com/terboubomar/talab/blob/main/src/lib/branch-operations.ts"
click node_catalogadmin "https://github.com/terboubomar/talab/blob/main/src/lib/catalog.ts"
click node_orderops "https://github.com/terboubomar/talab/blob/main/src/lib/order-detail.ts"
click node_reports "https://github.com/terboubomar/talab/blob/main/src/lib/report-center.ts"
click node_marketing "https://github.com/terboubomar/talab/blob/main/src/routes/_staffShell.admin.coupons.tsx"
click node_router "https://github.com/terboubomar/talab/blob/main/src/router.tsx"
click node_storefrontdata "https://github.com/terboubomar/talab/blob/main/src/lib/storefront.ts"
click node_menudata "https://github.com/terboubomar/talab/blob/main/src/lib/menu.ts"
click node_databaseclient "https://github.com/terboubomar/talab/blob/main/src/lib/supabase.ts"
click node_paymentfunctions "https://github.com/terboubomar/talab/blob/main/supabase/functions/moyasar-webhook/index.ts"
click node_foodics "https://github.com/terboubomar/talab/blob/main/supabase/functions/foodics-order-push/index.ts"
click node_loyverseworkspace "https://github.com/terboubomar/talab/blob/main/src/components/admin/LoyverseIntegrationWorkspace.tsx"
click node_driverapp "https://github.com/terboubomar/talab/blob/main/apps/driver/App.tsx"
click node_driverapi "https://github.com/terboubomar/talab/blob/main/apps/driver/src/lib/api.ts"
click node_driversupabase "https://github.com/terboubomar/talab/blob/main/apps/driver/src/lib/supabase.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_storefront,node_menu,node_cart,node_checkout,node_paymentform,node_customeraccount toneBlue
class node_adminroutes,node_branchops,node_catalogadmin,node_orderops,node_reports,node_marketing toneAmber
class node_router,node_storefrontdata,node_menudata,node_databaseclient,node_database toneMint
class node_paymentfunctions,node_foodics,node_loyverseworkspace toneRose
class node_driverapp,node_driverapi,node_driversupabase,node_customer toneIndigo
```

## Components

### Customer ordering

- [Storefront](https://github.com/terboubomar/talab/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Menu browsing](https://github.com/terboubomar/talab/blob/main/src/routes/menu.tsx): `src/routes/menu.tsx`
- [Cart state](https://github.com/terboubomar/talab/blob/main/src/lib/cart.ts): `src/lib/cart.ts`
- [Checkout](https://github.com/terboubomar/talab/blob/main/src/routes/checkout.tsx): `src/routes/checkout.tsx`
- [Payment form](https://github.com/terboubomar/talab/blob/main/src/components/moyasar-payment-form.tsx): `src/components/moyasar-payment-form.tsx`
- [Customer account](https://github.com/terboubomar/talab/blob/main/src/routes/account.tsx): `src/routes/account.tsx`

### Staff operations

- [Admin routes](https://github.com/terboubomar/talab/blob/main/src/routes/_staffShell.admin.orders.tsx): `src/routes/_staffShell.admin.orders.tsx`
- [Branch operations](https://github.com/terboubomar/talab/blob/main/src/lib/branch-operations.ts): `src/lib/branch-operations.ts`
- [Catalog management](https://github.com/terboubomar/talab/blob/main/src/lib/catalog.ts): `src/lib/catalog.ts`
- [Order operations](https://github.com/terboubomar/talab/blob/main/src/lib/order-detail.ts): `src/lib/order-detail.ts`
- [Reports](https://github.com/terboubomar/talab/blob/main/src/lib/report-center.ts): `src/lib/report-center.ts`
- [Marketing tools](https://github.com/terboubomar/talab/blob/main/src/routes/_staffShell.admin.coupons.tsx): `src/routes/_staffShell.admin.coupons.tsx`

### Shared platform

- [Application router](https://github.com/terboubomar/talab/blob/main/src/router.tsx): `src/router.tsx`
- [Storefront data](https://github.com/terboubomar/talab/blob/main/src/lib/storefront.ts): `src/lib/storefront.ts`
- [Menu data](https://github.com/terboubomar/talab/blob/main/src/lib/menu.ts): `src/lib/menu.ts`
- [Supabase client](https://github.com/terboubomar/talab/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase database**

### Integrations

- [Payment functions](https://github.com/terboubomar/talab/blob/main/supabase/functions/moyasar-webhook/index.ts): `supabase/functions/moyasar-webhook/index.ts`
- [Foodics functions](https://github.com/terboubomar/talab/blob/main/supabase/functions/foodics-order-push/index.ts): `supabase/functions/foodics-order-push/index.ts`
- [Loyverse workspace](https://github.com/terboubomar/talab/blob/main/src/components/admin/LoyverseIntegrationWorkspace.tsx): `src/components/admin/LoyverseIntegrationWorkspace.tsx`

### Driver app

- [Driver app](https://github.com/terboubomar/talab/blob/main/apps/driver/App.tsx): `apps/driver/App.tsx`
- [Driver API](https://github.com/terboubomar/talab/blob/main/apps/driver/src/lib/api.ts): `apps/driver/src/lib/api.ts`
- [Driver Supabase](https://github.com/terboubomar/talab/blob/main/apps/driver/src/lib/supabase.ts): `apps/driver/src/lib/supabase.ts`

### Other components

- **Customer**

## Connections

- Customer → Storefront: opens
- Application router → Storefront: routes to (evidence: `src/router.tsx`)
- Application router → Admin routes: routes to (evidence: `src/routeTree.gen.ts`)
- Storefront → Storefront data: loads context
- Menu browsing → Menu data: loads menu
- Checkout → Storefront data: reads selection (evidence: `src/routes/checkout.tsx`)
- Checkout → Cart state: reads cart (evidence: `src/routes/checkout.tsx`)
- Checkout → Menu data: formats items (evidence: `src/routes/checkout.tsx`)
- Checkout → Payment form: renders (evidence: `src/routes/checkout.tsx`)
- Customer account → Storefront data: uses data
- Admin routes → Branch operations: uses operations
- Admin routes → Reports: loads reports
- Admin routes → Marketing tools: routes to (evidence: `src/routeTree.gen.ts`)
- Marketing tools → Storefront data: uses settings
- Storefront data → Supabase client: queries (evidence: `src/lib/storefront.ts`)
- Menu data → Supabase client: queries (evidence: `src/lib/menu.ts`)
- Supabase client → Supabase database: connects (evidence: `src/lib/supabase.ts`)
- Driver app → Driver API: requests data (evidence: `apps/driver/App.tsx`)
- Driver API → Driver Supabase: uses client (evidence: `apps/driver/src/lib/api.ts`)
