# laityfaye/terangatable architecture

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

- Interactive diagram: https://gitdiagram.com/laityfaye/terangatable
- Repository: https://github.com/laityfaye/terangatable

## Overview

This is a multi-tenant restaurant operations SaaS: restaurant staff manage orders and service workflows, while diners discover restaurants, place orders or reservations, and leave reviews. Platform administrators oversee tenant onboarding and moderation. The API exposes domain modules behind tenant-aware authentication and authorization; web route groups indicate dashboard, public restaurant, and marketplace experiences. The tree documents broad capabilities, but many implementations were not sampled, so their connections are shown only as dashed, unverified relationships.

Main entry points: [`apps/web/src/app/(dashboard)/dashboard/page.tsx`](https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/(dashboard)/dashboard/page.tsx) (Staff dashboard), [`apps/api/src/modules/orders/orders.controller.ts`](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/orders/orders.controller.ts) (Order handling), [`apps/api/src/prisma/prisma.service.ts`](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/prisma/prisma.service.ts) (Tenant-scoped database), [`apps/api/src/modules/tenants/tenants.controller.ts`](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/tenants/tenants.controller.ts) (Tenant onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiences["User experiences"]
  node_dashboard["Staff dashboard<br/>[page.tsx]"]
  node_restaurant_site["Restaurant site<br/>[page.tsx]"]
  node_marketplace_ui["Restaurant marketplace<br/>[page.tsx]"]
end

subgraph group_restaurant["Restaurant operations"]
  node_orders_api["Order handling"]
  node_order_service["Order domain service<br/>[orders.service.ts]"]
  node_menu["Menu management"]
  node_payments["Payments"]
  node_pos["Point of sale<br/>[pos.service.ts]"]
  node_reservations["Reservations"]
  node_delivery["Delivery"]
  node_crm["Customer loyalty"]
  node_workflows["Order workflows<br/>[workflow.engine.ts]"]
end

subgraph group_public["Public services"]
  node_reviews_public["Public review endpoints"]
  node_reviews_service["Review management<br/>[reviews.service.ts]"]
  node_marketplace_api["Marketplace discovery"]
  node_website["Restaurant website settings<br/>[website.service.ts]"]
end

subgraph group_platform["Platform administration"]
  node_tenants["Tenant onboarding"]
  node_regions["Regional administration<br/>[regions.service.ts]"]
end

subgraph group_foundation["API foundation"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_tenant_access["Tenant access control<br/>[tenant.guard.ts]"]
  node_database[("Tenant-scoped database<br/>[prisma.service.ts]")]
  node_storage["Image storage<br/>[storage.service.ts]"]
end

node_staff(("Restaurant staff"))
node_diners(("Diners"))
node_platform_admin(("Platform admins"))
node_uploads[("Object storage")]

node_staff -.->|"uses"| node_dashboard
node_diners -.->|"visits"| node_restaurant_site
node_diners -.->|"discovers"| node_marketplace_ui
node_platform_admin -.->|"administers"| node_tenants
node_dashboard -.->|"manages orders"| node_orders_api
node_restaurant_site -.->|"reads reviews"| node_reviews_public
node_restaurant_site -.->|"browses menu"| node_menu
node_marketplace_ui -.->|"searches restaurants"| node_marketplace_api
node_orders_api -->|"delegates to"| node_order_service
node_orders_api -->|"reads order data"| node_order_service
node_orders_api -->|"loads custom fields"| node_reviews_service
node_orders_api -.->|"uses domain data"| node_database
node_order_service -.->|"reads and writes"| node_database
node_orders_api -.->|"runs transitions"| node_workflows
node_orders_api -.->|"uses payment data"| node_payments
node_reviews_public -->|"delegates to"| node_reviews_service
node_reviews_public -->|"looks up tenant"| node_database
node_reviews_service -->|"reads and writes"| node_database
node_tenants -->|"moderates reviews"| node_reviews_service
node_tenants -.->|"manages tenants"| node_database
node_website -->|"uses uploads"| node_storage
node_storage -->|"stores images"| node_uploads
node_auth -->|"uses identity data"| node_database
node_tenant_access -.->|"enforces tenant scope"| node_database
node_dashboard -.->|"maintains catalog"| node_menu
node_dashboard -.->|"reviews payments"| node_payments
node_dashboard -.->|"operates register"| node_pos
node_dashboard -.->|"manages bookings"| node_reservations
node_dashboard -.->|"dispatches deliveries"| node_delivery
node_dashboard -.->|"manages customers"| node_crm
node_diners -.->|"books tables"| node_reservations
node_diners -.->|"places orders"| node_orders_api
node_tenants -.->|"assigns regional oversight"| node_regions

click node_dashboard "https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/(dashboard)/dashboard/page.tsx"
click node_restaurant_site "https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/%5Bslug%5D/page.tsx"
click node_marketplace_ui "https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/(marketplace)/decouvrir/page.tsx"
click node_orders_api "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/orders/orders.controller.ts"
click node_order_service "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/orders/orders.service.ts"
click node_menu "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/menu/products/products.service.ts"
click node_payments "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/payments/payments.service.ts"
click node_pos "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/pos/pos.service.ts"
click node_reservations "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reservations/reservations.service.ts"
click node_delivery "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/delivery/delivery.service.ts"
click node_crm "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/crm/customers.service.ts"
click node_workflows "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/workflows/workflow.engine.ts"
click node_reviews_public "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reviews/reviews-public.controller.ts"
click node_reviews_service "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reviews/reviews.service.ts"
click node_marketplace_api "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/marketplace/marketplace.service.ts"
click node_website "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/website/website.service.ts"
click node_tenants "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/tenants/tenants.controller.ts"
click node_regions "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/regions/regions.service.ts"
click node_auth "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/auth/auth.service.ts"
click node_tenant_access "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/common/guards/tenant.guard.ts"
click node_database "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/prisma/prisma.service.ts"
click node_storage "https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/storage/storage.service.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_dashboard,node_restaurant_site,node_marketplace_ui toneBlue
class node_orders_api,node_order_service,node_menu,node_payments,node_pos,node_reservations,node_delivery,node_crm,node_workflows,node_uploads toneAmber
class node_reviews_public,node_reviews_service,node_marketplace_api,node_website toneMint
class node_tenants,node_regions toneRose
class node_auth,node_tenant_access,node_database,node_storage,node_staff,node_diners,node_platform_admin toneIndigo
```

## Components

### User experiences

- [Staff dashboard](https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/(dashboard)/dashboard/page.tsx): `apps/web/src/app/(dashboard)/dashboard/page.tsx`
- [Restaurant site](https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/%5Bslug%5D/page.tsx): `apps/web/src/app/[slug]/page.tsx`
- [Restaurant marketplace](https://github.com/laityfaye/terangatable/blob/main/apps/web/src/app/(marketplace)/decouvrir/page.tsx): `apps/web/src/app/(marketplace)/decouvrir/page.tsx`

### Restaurant operations

- [Order handling](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/orders/orders.controller.ts): `apps/api/src/modules/orders/orders.controller.ts`
- [Order domain service](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/orders/orders.service.ts): `apps/api/src/modules/orders/orders.service.ts`
- [Menu management](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/menu/products/products.service.ts): `apps/api/src/modules/menu/products/products.service.ts`
- [Payments](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/payments/payments.service.ts): `apps/api/src/modules/payments/payments.service.ts`
- [Point of sale](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/pos/pos.service.ts): `apps/api/src/modules/pos/pos.service.ts`
- [Reservations](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reservations/reservations.service.ts): `apps/api/src/modules/reservations/reservations.service.ts`
- [Delivery](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/delivery/delivery.service.ts): `apps/api/src/modules/delivery/delivery.service.ts`
- [Customer loyalty](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/crm/customers.service.ts): `apps/api/src/modules/crm/customers.service.ts`
- [Order workflows](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/workflows/workflow.engine.ts): `apps/api/src/modules/workflows/workflow.engine.ts`

### Public services

- [Public review endpoints](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reviews/reviews-public.controller.ts): `apps/api/src/modules/reviews/reviews-public.controller.ts`
- [Review management](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/reviews/reviews.service.ts): `apps/api/src/modules/reviews/reviews.service.ts`
- [Marketplace discovery](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/marketplace/marketplace.service.ts): `apps/api/src/modules/marketplace/marketplace.service.ts`
- [Restaurant website settings](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/website/website.service.ts): `apps/api/src/modules/website/website.service.ts`

### Platform administration

- [Tenant onboarding](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/tenants/tenants.controller.ts): `apps/api/src/modules/tenants/tenants.controller.ts`
- [Regional administration](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/regions/regions.service.ts): `apps/api/src/modules/regions/regions.service.ts`

### API foundation

- [Authentication](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/auth/auth.service.ts): `apps/api/src/modules/auth/auth.service.ts`
- [Tenant access control](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/common/guards/tenant.guard.ts): `apps/api/src/common/guards/tenant.guard.ts`
- [Tenant-scoped database](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/prisma/prisma.service.ts): `apps/api/src/prisma/prisma.service.ts`
- [Image storage](https://github.com/laityfaye/terangatable/blob/main/apps/api/src/modules/storage/storage.service.ts): `apps/api/src/modules/storage/storage.service.ts`

### Other components

- **Restaurant staff**
- **Diners**
- **Platform admins**
- **Object storage**

## Connections

- Restaurant staff → Staff dashboard: uses
- Diners → Restaurant site: visits
- Diners → Restaurant marketplace: discovers
- Platform admins → Tenant onboarding: administers
- Staff dashboard → Order handling: manages orders
- Restaurant site → Public review endpoints: reads reviews
- Restaurant site → Menu management: browses menu
- Restaurant marketplace → Marketplace discovery: searches restaurants
- Order handling → Order domain service: delegates to (evidence: `apps/api/src/modules/orders/orders.controller.ts`)
- Order handling → Order domain service: reads order data (evidence: `apps/api/src/modules/orders/orders.controller.ts`)
- Order handling → Review management: loads custom fields (evidence: `apps/api/src/modules/orders/orders.controller.ts`)
- Order handling → Tenant-scoped database: uses domain data
- Order domain service → Tenant-scoped database: reads and writes
- Order handling → Order workflows: runs transitions
- Order handling → Payments: uses payment data
- Public review endpoints → Review management: delegates to (evidence: `apps/api/src/modules/reviews/reviews-public.controller.ts`)
- Public review endpoints → Tenant-scoped database: looks up tenant (evidence: `apps/api/src/modules/reviews/reviews-public.controller.ts`)
- Review management → Tenant-scoped database: reads and writes (evidence: `apps/api/src/modules/reviews/reviews.service.ts`)
- Tenant onboarding → Review management: moderates reviews (evidence: `apps/api/src/modules/tenants/tenants.controller.ts`)
- Tenant onboarding → Tenant-scoped database: manages tenants
- Restaurant website settings → Image storage: uses uploads (evidence: `apps/api/src/modules/website/website-dashboard.controller.ts`)
- Image storage → Object storage: stores images (evidence: `apps/api/src/modules/storage/storage.service.ts`)
- Authentication → Tenant-scoped database: uses identity data (evidence: `apps/api/src/modules/auth/auth.service.ts`)
- Tenant access control → Tenant-scoped database: enforces tenant scope
- Staff dashboard → Menu management: maintains catalog
- Staff dashboard → Payments: reviews payments
- Staff dashboard → Point of sale: operates register
- Staff dashboard → Reservations: manages bookings
- Staff dashboard → Delivery: dispatches deliveries
- Staff dashboard → Customer loyalty: manages customers
- Diners → Reservations: books tables
- Diners → Order handling: places orders
- Tenant onboarding → Regional administration: assigns regional oversight
