# twariqabdul/restaurant_os architecture

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

- Interactive diagram: https://gitdiagram.com/twariqabdul/restaurant_os
- Repository: https://github.com/twariqabdul/restaurant_os

## Overview

This repository implements a multi-tenant commerce platform: shoppers browse stores, build carts, check out, and track orders; merchants manage orders, products, store presentation, customers, and finances; platform staff administer merchants and payments. The tree and excerpts show both a newer Express/pg API and a legacy Express/Supabase app, so the graph keeps those server stacks distinct. Source evidence is incomplete, and the README is empty; dashed, uncited edges mark likely but unverified links rather than asserted calls.

Main entry points: [`client/src/console/Orders.tsx`](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Orders.tsx) (Merchant console), [`client/src/app/routes.tsx`](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/app/routes.tsx) (Client routing), [`server/src/api/app.ts`](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/api/app.ts) (API request routing), [`server/src/app.js`](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/app.js) (Legacy API routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopper["Shopper experience"]
  node_client_routes["Client routing<br/>[routes.tsx]"]
  node_storefront["Storefront<br/>[Storefront.tsx]"]
  node_shopper_checkout["Cart and checkout<br/>[CheckoutPage.tsx]"]
  node_shopper_tracking["Order tracking<br/>[TrackPage.tsx]"]
end

subgraph group_merchant["Merchant operations"]
  node_merchant_console["Merchant console<br/>[Orders.tsx]"]
  node_merchant_products["Product management<br/>[Products.tsx]"]
  node_merchant_store["Store design and settings<br/>[ThemeStudio.tsx]"]
  node_merchant_finance["Wallet and payouts<br/>[Wallet.tsx]"]
  node_merchant_analytics["Analytics and exports<br/>[Analytics.tsx]"]
  node_support_kyc["Support and verification<br/>[Complaints.tsx]"]
end

subgraph group_platform["Platform administration"]
  node_platform_admin["Platform administration<br/>[Admin.tsx]"]
end

subgraph group_backend["Commerce services"]
  node_api_entry["API request routing<br/>[app.ts]"]
  node_legacy_entry["Legacy API routing<br/>[app.js]"]
  node_commerce_routes["Commerce endpoints"]
  node_orders["Order and catalogue data<br/>[collections.ts]"]
  node_payments["Payment and wallet service<br/>[walletService.js]"]
  node_payment_provider["MoMo provider<br/>[momoClient.js]"]
end

subgraph group_shared["Shared infrastructure"]
  node_auth["Sign-in and onboarding<br/>[steps.tsx]"]
  node_database[("Application database<br/>[index.ts]")]
  node_tenant_context["Tenant and session context<br/>[tenant.js]"]
  node_messaging["Messaging jobs<br/>[messaging.ts]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_client_routes
node_client_routes -->|"routes to"| node_storefront
node_storefront -.->|"renders"| node_shopper_checkout
node_storefront -.->|"renders"| node_shopper_tracking
node_client_routes -->|"routes to"| node_auth
node_client_routes -.->|"routes to"| node_merchant_console
node_client_routes -->|"routes to"| node_platform_admin
node_merchant_console -.->|"manages"| node_merchant_products
node_merchant_console -.->|"configures"| node_merchant_store
node_merchant_console -.->|"manages"| node_merchant_finance
node_merchant_console -.->|"views"| node_merchant_analytics
node_merchant_console -.->|"handles"| node_support_kyc
node_api_entry -->|"mounts"| node_commerce_routes
node_legacy_entry -->|"resolves tenant"| node_tenant_context
node_legacy_entry -.->|"mounts routes"| node_orders
node_commerce_routes -.->|"uses"| node_orders
node_orders -.->|"reads and writes"| node_database
node_payments -->|"requests payment"| node_payment_provider
node_payments -.->|"records transactions"| node_database
node_api_entry -->|"uses"| node_database
node_api_entry -->|"starts jobs"| node_messaging
node_legacy_entry -.->|"routes payment callbacks"| node_payments

click node_client_routes "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/app/routes.tsx"
click node_storefront "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/Storefront.tsx"
click node_shopper_checkout "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/CheckoutPage.tsx"
click node_shopper_tracking "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/TrackPage.tsx"
click node_auth "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/auth/steps.tsx"
click node_merchant_console "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Orders.tsx"
click node_merchant_products "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Products.tsx"
click node_merchant_store "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/ThemeStudio.tsx"
click node_merchant_finance "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Wallet.tsx"
click node_merchant_analytics "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Analytics.tsx"
click node_support_kyc "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Complaints.tsx"
click node_platform_admin "https://github.com/twariqabdul/restaurant_os/blob/master/client/src/admin/Admin.tsx"
click node_api_entry "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/api/app.ts"
click node_legacy_entry "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/app.js"
click node_commerce_routes "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/routes/storefrontCheckout.ts"
click node_orders "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/repositories/collections.ts"
click node_payments "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/services/walletService.js"
click node_payment_provider "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/services/momoClient.js"
click node_database "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/db/index.ts"
click node_tenant_context "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/middleware/tenant.js"
click node_messaging "https://github.com/twariqabdul/restaurant_os/blob/master/server/src/jobs/messaging.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_client_routes,node_storefront,node_shopper_checkout,node_shopper_tracking toneBlue
class node_merchant_console,node_merchant_products,node_merchant_store,node_merchant_finance,node_merchant_analytics,node_support_kyc toneAmber
class node_platform_admin toneMint
class node_api_entry,node_legacy_entry,node_commerce_routes,node_orders,node_payments,node_payment_provider toneRose
class node_auth,node_database,node_tenant_context,node_messaging,node_shopper toneIndigo
```

## Components

### Shopper experience

- [Client routing](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/app/routes.tsx): `client/src/app/routes.tsx`
- [Storefront](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/Storefront.tsx): `client/src/storefront/Storefront.tsx`
- [Cart and checkout](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/CheckoutPage.tsx): `client/src/storefront/CheckoutPage.tsx`
- [Order tracking](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/storefront/TrackPage.tsx): `client/src/storefront/TrackPage.tsx`

### Merchant operations

- [Merchant console](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Orders.tsx): `client/src/console/Orders.tsx`
- [Product management](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Products.tsx): `client/src/console/Products.tsx`
- [Store design and settings](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/ThemeStudio.tsx): `client/src/console/ThemeStudio.tsx`
- [Wallet and payouts](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Wallet.tsx): `client/src/console/Wallet.tsx`
- [Analytics and exports](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Analytics.tsx): `client/src/console/Analytics.tsx`
- [Support and verification](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/console/Complaints.tsx): `client/src/console/Complaints.tsx`

### Platform administration

- [Platform administration](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/admin/Admin.tsx): `client/src/admin/Admin.tsx`

### Commerce services

- [API request routing](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/api/app.ts): `server/src/api/app.ts`
- [Legacy API routing](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/app.js): `server/src/app.js`
- [Commerce endpoints](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/routes/storefrontCheckout.ts): `server/src/routes/storefrontCheckout.ts`
- [Order and catalogue data](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/repositories/collections.ts): `server/src/repositories/collections.ts`
- [Payment and wallet service](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/services/walletService.js): `server/src/services/walletService.js`
- [MoMo provider](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/services/momoClient.js): `server/src/services/momoClient.js`

### Shared infrastructure

- [Sign-in and onboarding](https://github.com/twariqabdul/restaurant_os/blob/master/client/src/auth/steps.tsx): `client/src/auth/steps.tsx`
- [Application database](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/db/index.ts): `server/src/db/index.ts`
- [Tenant and session context](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/middleware/tenant.js): `server/src/middleware/tenant.js`
- [Messaging jobs](https://github.com/twariqabdul/restaurant_os/blob/master/server/src/jobs/messaging.ts): `server/src/jobs/messaging.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Client routing: uses (evidence: `client/src/app/routes.tsx`)
- Client routing → Storefront: routes to (evidence: `client/src/app/routes.tsx`)
- Storefront → Cart and checkout: renders
- Storefront → Order tracking: renders
- Client routing → Sign-in and onboarding: routes to (evidence: `client/src/app/routes.tsx`)
- Client routing → Merchant console: routes to
- Client routing → Platform administration: routes to (evidence: `client/src/app/routes.tsx`)
- Merchant console → Product management: manages
- Merchant console → Store design and settings: configures
- Merchant console → Wallet and payouts: manages
- Merchant console → Analytics and exports: views
- Merchant console → Support and verification: handles
- API request routing → Commerce endpoints: mounts (evidence: `server/src/api/app.ts`)
- Legacy API routing → Tenant and session context: resolves tenant (evidence: `server/src/app.js`)
- Legacy API routing → Order and catalogue data: mounts routes
- Commerce endpoints → Order and catalogue data: uses
- Order and catalogue data → Application database: reads and writes
- Payment and wallet service → MoMo provider: requests payment (evidence: `server/src/services/walletService.js`)
- Payment and wallet service → Application database: records transactions
- API request routing → Application database: uses (evidence: `server/src/api/server.ts`)
- API request routing → Messaging jobs: starts jobs (evidence: `server/src/api/server.ts`)
- Legacy API routing → Payment and wallet service: routes payment callbacks
