# nicotordev/bocao.app architecture

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

- Interactive diagram: https://gitdiagram.com/nicotordev/bocao.app
- Repository: https://github.com/nicotordev/bocao.app

## Overview

Bocao.app is a multi-tenant restaurant operations platform. Restaurant staff use its dashboard to manage orders and kitchen work, reservations and floor plans, menus, and customer relationships; the product also provides team access, WhatsApp workflows, marketing assistance, and analytics. The graph preserves those documented capabilities and highlights sampled client-to-action/query and API-to-service links. Some feature implementations were not sampled, so their internal relationships are omitted rather than inferred.

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/nicotordev/bocao.app/blob/main/src/app/dashboard/layout.tsx) (Dashboard shell), [`src/components/dashboard/floor-plan/floor-plan-page-client.tsx`](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/floor-plan/floor-plan-page-client.tsx) (Floor plans), [`src/components/dashboard/menu/menu-page-client.tsx`](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/menu/menu-page-client.tsx) (Menu management), [`src/components/dashboard/customers/customers-page-client.tsx`](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/customers/customers-page-client.tsx) (Customer workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and tenancy"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_team["Team and permissions<br/>[service.ts]"]
  node_dashboard["Dashboard shell<br/>[layout.tsx]"]
end

subgraph group_operations["Restaurant operations"]
  node_orders["Order management"]
  node_kitchen["Kitchen display"]
  node_reservations["Reservations"]
  node_floorplan["Floor plans"]
  node_menu["Menu management"]
  node_productflow["Product flow engine<br/>[engine.ts]"]
end

subgraph group_customers["Customers and growth"]
  node_customers_ui["Customer workspace"]
  node_customer_service["Customer data service<br/>[server.ts]"]
  node_marketing["Marketing assistant"]
end

subgraph group_insights["Analytics and insights"]
  node_analytics["Restaurant analytics<br/>[service.ts]"]
  node_analytics_ui["Analytics dashboard"]
  node_smart_segments["Smart segments<br/>[cron.ts]"]
end

subgraph group_platform["Messaging and shared services"]
  node_whatsapp["WhatsApp workflows"]
  node_meta{{"WhatsApp Cloud API"}}
  node_database[("PostgreSQL")]
  node_settings["Restaurant settings"]
  node_floor_action["Floor plan action<br/>[floor-plan.ts]"]
end

node_staff(("Restaurant staff"))

node_staff -->|"uses"| node_dashboard
node_dashboard -.->|"scopes access"| node_auth
node_dashboard -.->|"manages membership"| node_team
node_staff -->|"manages orders"| node_orders
node_staff -->|"works kitchen queue"| node_kitchen
node_staff -->|"manages bookings"| node_reservations
node_staff -->|"manages tables"| node_floorplan
node_staff -->|"manages menu"| node_menu
node_menu -->|"uses engine"| node_productflow
node_staff -->|"manages customers"| node_customers_ui
node_customers_ui -->|"queries service"| node_customer_service
node_staff -->|"creates campaigns"| node_marketing
node_staff -->|"reviews analytics"| node_analytics_ui
node_analytics_ui -.->|"loads insights"| node_analytics
node_smart_segments -.->|"stores snapshots"| node_database
node_meta -->|"sends events"| node_whatsapp
node_whatsapp -.->|"sends messages"| node_meta
node_staff -->|"configures restaurant"| node_settings
node_floorplan -->|"saves layout"| node_floor_action

click node_auth "https://github.com/nicotordev/bocao.app/blob/main/src/lib/auth.ts"
click node_team "https://github.com/nicotordev/bocao.app/blob/main/src/lib/team/service.ts"
click node_dashboard "https://github.com/nicotordev/bocao.app/blob/main/src/app/dashboard/layout.tsx"
click node_orders "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/orders/orders-page-client.tsx"
click node_kitchen "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/kitchen/kitchen-page-client.tsx"
click node_reservations "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/reservations/reservations-page-client.tsx"
click node_floorplan "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/floor-plan/floor-plan-page-client.tsx"
click node_menu "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/menu/menu-page-client.tsx"
click node_productflow "https://github.com/nicotordev/bocao.app/blob/main/src/lib/product-flow/engine.ts"
click node_customers_ui "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/customers/customers-page-client.tsx"
click node_customer_service "https://github.com/nicotordev/bocao.app/blob/main/src/lib/customers/server.ts"
click node_marketing "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/marketing/marketing-ai-new-page-client.tsx"
click node_analytics "https://github.com/nicotordev/bocao.app/blob/main/src/lib/analytics/service.ts"
click node_analytics_ui "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/analytics/analytics-page-client.tsx"
click node_smart_segments "https://github.com/nicotordev/bocao.app/blob/main/src/lib/customers/smart-segments/cron.ts"
click node_whatsapp "https://github.com/nicotordev/bocao.app/blob/main/src/lib/messaging/process-incoming.ts"
click node_settings "https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/settings/settings-page-client.tsx"
click node_floor_action "https://github.com/nicotordev/bocao.app/blob/main/src/app/actions/floor-plan.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_auth,node_team,node_dashboard toneBlue
class node_orders,node_kitchen,node_reservations,node_floorplan,node_menu,node_productflow toneAmber
class node_customers_ui,node_customer_service,node_marketing toneMint
class node_analytics,node_analytics_ui,node_smart_segments toneRose
class node_whatsapp,node_meta,node_database,node_settings,node_floor_action,node_staff toneIndigo
```

## Components

### Access and tenancy

- [Authentication](https://github.com/nicotordev/bocao.app/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Team and permissions](https://github.com/nicotordev/bocao.app/blob/main/src/lib/team/service.ts): `src/lib/team/service.ts`
- [Dashboard shell](https://github.com/nicotordev/bocao.app/blob/main/src/app/dashboard/layout.tsx): `src/app/dashboard/layout.tsx`

### Restaurant operations

- [Order management](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/orders/orders-page-client.tsx): `src/components/dashboard/orders/orders-page-client.tsx`
- [Kitchen display](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/kitchen/kitchen-page-client.tsx): `src/components/dashboard/kitchen/kitchen-page-client.tsx`
- [Reservations](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/reservations/reservations-page-client.tsx): `src/components/dashboard/reservations/reservations-page-client.tsx`
- [Floor plans](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/floor-plan/floor-plan-page-client.tsx): `src/components/dashboard/floor-plan/floor-plan-page-client.tsx`
- [Menu management](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/menu/menu-page-client.tsx): `src/components/dashboard/menu/menu-page-client.tsx`
- [Product flow engine](https://github.com/nicotordev/bocao.app/blob/main/src/lib/product-flow/engine.ts): `src/lib/product-flow/engine.ts`

### Customers and growth

- [Customer workspace](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/customers/customers-page-client.tsx): `src/components/dashboard/customers/customers-page-client.tsx`
- [Customer data service](https://github.com/nicotordev/bocao.app/blob/main/src/lib/customers/server.ts): `src/lib/customers/server.ts`
- [Marketing assistant](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/marketing/marketing-ai-new-page-client.tsx): `src/components/dashboard/marketing/marketing-ai-new-page-client.tsx`

### Analytics and insights

- [Restaurant analytics](https://github.com/nicotordev/bocao.app/blob/main/src/lib/analytics/service.ts): `src/lib/analytics/service.ts`
- [Analytics dashboard](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/analytics/analytics-page-client.tsx): `src/components/dashboard/analytics/analytics-page-client.tsx`
- [Smart segments](https://github.com/nicotordev/bocao.app/blob/main/src/lib/customers/smart-segments/cron.ts): `src/lib/customers/smart-segments/cron.ts`

### Messaging and shared services

- [WhatsApp workflows](https://github.com/nicotordev/bocao.app/blob/main/src/lib/messaging/process-incoming.ts): `src/lib/messaging/process-incoming.ts`
- **WhatsApp Cloud API**
- **PostgreSQL**
- [Restaurant settings](https://github.com/nicotordev/bocao.app/blob/main/src/components/dashboard/settings/settings-page-client.tsx): `src/components/dashboard/settings/settings-page-client.tsx`
- [Floor plan action](https://github.com/nicotordev/bocao.app/blob/main/src/app/actions/floor-plan.ts): `src/app/actions/floor-plan.ts`

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → Authentication: scopes access
- Dashboard shell → Team and permissions: manages membership
- Restaurant staff → Order management: manages orders (evidence: `README.md`)
- Restaurant staff → Kitchen display: works kitchen queue (evidence: `README.md`)
- Restaurant staff → Reservations: manages bookings (evidence: `README.md`)
- Restaurant staff → Floor plans: manages tables (evidence: `README.md`)
- Restaurant staff → Menu management: manages menu (evidence: `README.md`)
- Menu management → Product flow engine: uses engine (evidence: `src/lib/product-flow/engine.ts`)
- Restaurant staff → Customer workspace: manages customers (evidence: `README.md`)
- Customer workspace → Customer data service: queries service (evidence: `src/lib/customers/server.ts`)
- Restaurant staff → Marketing assistant: creates campaigns (evidence: `README.md`)
- Restaurant staff → Analytics dashboard: reviews analytics (evidence: `README.md`)
- Analytics dashboard → Restaurant analytics: loads insights
- Smart segments → PostgreSQL: stores snapshots
- WhatsApp Cloud API → WhatsApp workflows: sends events
- WhatsApp workflows → WhatsApp Cloud API: sends messages
- Restaurant staff → Restaurant settings: configures restaurant (evidence: `README.md`)
- Floor plans → Floor plan action: saves layout (evidence: `src/components/dashboard/floor-plan/floor-plan-page-client.tsx`)
