# end2-237/camille architecture

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

- Interactive diagram: https://gitdiagram.com/end2-237/camille
- Repository: https://github.com/end2-237/camille

## Overview

Camille is a SaaS platform for configuring AI business agents that serve customers over WhatsApp, with catalog, order, delivery, and operational analytics features. The principal workflow is: a business user creates an agent, connects WhatsApp, customers interact with it, orders are recorded, and the business manages fulfillment and performance through web or mobile dashboards. The graph emphasizes routes and service calls confirmed by sampled source; several capabilities are represented by their exact API paths from the tree, but their internal wiring was not sampled.

Main entry points: [`app/dashboard/[agentId]/page.tsx`](https://github.com/end2-237/camille/blob/main/app/dashboard/%5BagentId%5D/page.tsx) (Web dashboard), [`lib/db.ts`](https://github.com/end2-237/camille/blob/main/lib/db.ts) (Database access), [`app/api/waha/session-event/route.ts`](https://github.com/end2-237/camille/blob/main/app/api/waha/session-event/route.ts) (WhatsApp sessions), [`app/api/agents/[agentId]/route.ts`](https://github.com/end2-237/camille/blob/main/app/api/agents/%5BagentId%5D/route.ts) (Agent settings API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web_app["Web dashboard<br/>[page.tsx]"]
  node_mobile_app["Mobile app<br/>[App.js]"]
end

subgraph group_agents["Agent management"]
  node_agent_setup["Agent setup<br/>[StepperForm.tsx]"]
  node_agent_api["Agent API<br/>[route.ts]"]
  node_agent_detail_api["Agent settings API<br/>[route.ts]"]
end

subgraph group_messaging["WhatsApp automation"]
  node_whatsapp_api["WhatsApp sessions<br/>[route.ts]"]
  node_waha_client["WhatsApp connector<br/>[waha.ts]"]
end

subgraph group_commerce["Commerce and delivery"]
  node_catalog_api["Catalog API<br/>[route.ts]"]
  node_orders_api["Order API<br/>[route.ts]"]
  node_order_service["Order service<br/>[orders.ts]"]
  node_order_management["Order management API<br/>[route.ts]"]
  node_courier_api["Courier APIs<br/>[route.ts]"]
  node_public_api["Public commerce API<br/>[route.ts]"]
end

subgraph group_operations["Operations and analytics"]
  node_analytics_api["Analytics API<br/>[route.ts]"]
  node_conversation_analytics["Conversation analysis<br/>[route.ts]"]
  node_complaints_api["Complaints API<br/>[route.ts]"]
  node_notifications["Push notifications<br/>[fcm.ts]"]
  node_db_adapter["Database access<br/>[db.ts]"]
end

node_business_user(("Business user"))
node_customer(("Customer"))
node_whatsapp["WhatsApp service"]
node_workflow["Conversation workflow"]
node_postgres[("PostgreSQL data")]

node_business_user -->|"uses"| node_web_app
node_business_user -->|"uses"| node_mobile_app
node_web_app -->|"configures"| node_agent_setup
node_agent_setup -->|"creates agent"| node_agent_api
node_web_app -->|"manages agents"| node_agent_api
node_web_app -->|"updates settings"| node_agent_detail_api
node_mobile_app -->|"manages agents"| node_agent_api
node_agent_api -->|"queries and writes"| node_db_adapter
node_agent_detail_api -->|"queries and writes"| node_db_adapter
node_agent_detail_api -->|"sets webhook"| node_waha_client
node_waha_client -->|"controls sessions"| node_whatsapp
node_whatsapp -->|"sends events"| node_whatsapp_api
node_whatsapp_api -->|"reads and updates"| node_db_adapter
node_whatsapp_api -->|"notifies owner"| node_notifications
node_whatsapp_api -->|"activates draft"| node_agent_detail_api
node_customer -->|"messages"| node_whatsapp
node_workflow -.->|"retrieves catalog"| node_catalog_api
node_workflow -->|"submits order"| node_orders_api
node_orders_api -->|"resolves session"| node_db_adapter
node_orders_api -->|"creates order"| node_order_service
node_order_service -->|"persists order"| node_db_adapter
node_web_app -->|"manages catalog"| node_catalog_api
node_web_app -->|"manages fulfillment"| node_order_management
node_mobile_app -->|"manages fulfillment"| node_order_management
node_order_management -->|"reads and updates"| node_db_adapter
node_web_app -->|"tracks delivery"| node_courier_api
node_customer -->|"places or tracks order"| node_public_api
node_public_api -->|"accesses commerce data"| node_db_adapter
node_web_app -->|"views metrics"| node_analytics_api
node_analytics_api -->|"queries metrics"| node_db_adapter
node_analytics_api -->|"fetches session analytics"| node_waha_client
node_web_app -->|"analyzes conversations"| node_conversation_analytics
node_conversation_analytics -->|"reads conversations"| node_db_adapter
node_web_app -->|"manages complaints"| node_complaints_api
node_complaints_api -->|"reads and updates"| node_db_adapter
node_complaints_api -->|"sends client message"| node_whatsapp
node_db_adapter -->|"queries"| node_postgres

click node_web_app "https://github.com/end2-237/camille/blob/main/app/dashboard/%5BagentId%5D/page.tsx"
click node_mobile_app "https://github.com/end2-237/camille/blob/main/mobile/App.js"
click node_agent_setup "https://github.com/end2-237/camille/blob/main/components/configurator/StepperForm.tsx"
click node_agent_api "https://github.com/end2-237/camille/blob/main/app/api/agents/route.ts"
click node_agent_detail_api "https://github.com/end2-237/camille/blob/main/app/api/agents/%5BagentId%5D/route.ts"
click node_catalog_api "https://github.com/end2-237/camille/blob/main/app/api/catalog/%5BagentId%5D/route.ts"
click node_whatsapp_api "https://github.com/end2-237/camille/blob/main/app/api/waha/session-event/route.ts"
click node_waha_client "https://github.com/end2-237/camille/blob/main/lib/waha.ts"
click node_orders_api "https://github.com/end2-237/camille/blob/main/app/api/orders/route.ts"
click node_order_service "https://github.com/end2-237/camille/blob/main/lib/orders.ts"
click node_order_management "https://github.com/end2-237/camille/blob/main/app/api/orders/%5BorderId%5D/route.ts"
click node_courier_api "https://github.com/end2-237/camille/blob/main/app/api/courier/orders/route.ts"
click node_public_api "https://github.com/end2-237/camille/blob/main/app/api/public/v1/orders/route.ts"
click node_analytics_api "https://github.com/end2-237/camille/blob/main/app/api/stats/route.ts"
click node_conversation_analytics "https://github.com/end2-237/camille/blob/main/app/api/analytics/conversations/route.ts"
click node_complaints_api "https://github.com/end2-237/camille/blob/main/app/api/complaints/route.ts"
click node_notifications "https://github.com/end2-237/camille/blob/main/lib/fcm.ts"
click node_db_adapter "https://github.com/end2-237/camille/blob/main/lib/db.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_web_app,node_mobile_app,node_business_user toneBlue
class node_agent_setup,node_agent_api,node_agent_detail_api,node_postgres toneAmber
class node_whatsapp_api,node_waha_client toneMint
class node_catalog_api,node_orders_api,node_order_service,node_order_management,node_courier_api,node_public_api toneRose
class node_analytics_api,node_conversation_analytics,node_complaints_api,node_notifications,node_db_adapter,node_customer,node_whatsapp,node_workflow toneIndigo
```

## Components

### User interfaces

- [Web dashboard](https://github.com/end2-237/camille/blob/main/app/dashboard/%5BagentId%5D/page.tsx): `app/dashboard/[agentId]/page.tsx`
- [Mobile app](https://github.com/end2-237/camille/blob/main/mobile/App.js): `mobile/App.js`

### Agent management

- [Agent setup](https://github.com/end2-237/camille/blob/main/components/configurator/StepperForm.tsx): `components/configurator/StepperForm.tsx`
- [Agent API](https://github.com/end2-237/camille/blob/main/app/api/agents/route.ts): `app/api/agents/route.ts`
- [Agent settings API](https://github.com/end2-237/camille/blob/main/app/api/agents/%5BagentId%5D/route.ts): `app/api/agents/[agentId]/route.ts`

### WhatsApp automation

- [WhatsApp sessions](https://github.com/end2-237/camille/blob/main/app/api/waha/session-event/route.ts): `app/api/waha/session-event/route.ts`
- [WhatsApp connector](https://github.com/end2-237/camille/blob/main/lib/waha.ts): `lib/waha.ts`

### Commerce and delivery

- [Catalog API](https://github.com/end2-237/camille/blob/main/app/api/catalog/%5BagentId%5D/route.ts): `app/api/catalog/[agentId]/route.ts`
- [Order API](https://github.com/end2-237/camille/blob/main/app/api/orders/route.ts): `app/api/orders/route.ts`
- [Order service](https://github.com/end2-237/camille/blob/main/lib/orders.ts): `lib/orders.ts`
- [Order management API](https://github.com/end2-237/camille/blob/main/app/api/orders/%5BorderId%5D/route.ts): `app/api/orders/[orderId]/route.ts`
- [Courier APIs](https://github.com/end2-237/camille/blob/main/app/api/courier/orders/route.ts): `app/api/courier/orders/route.ts`
- [Public commerce API](https://github.com/end2-237/camille/blob/main/app/api/public/v1/orders/route.ts): `app/api/public/v1/orders/route.ts`

### Operations and analytics

- [Analytics API](https://github.com/end2-237/camille/blob/main/app/api/stats/route.ts): `app/api/stats/route.ts`
- [Conversation analysis](https://github.com/end2-237/camille/blob/main/app/api/analytics/conversations/route.ts): `app/api/analytics/conversations/route.ts`
- [Complaints API](https://github.com/end2-237/camille/blob/main/app/api/complaints/route.ts): `app/api/complaints/route.ts`
- [Push notifications](https://github.com/end2-237/camille/blob/main/lib/fcm.ts): `lib/fcm.ts`
- [Database access](https://github.com/end2-237/camille/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **Business user**
- **Customer**
- **WhatsApp service**
- **Conversation workflow**
- **PostgreSQL data**

## Connections

- Business user → Web dashboard: uses
- Business user → Mobile app: uses
- Web dashboard → Agent setup: configures
- Agent setup → Agent API: creates agent
- Web dashboard → Agent API: manages agents
- Web dashboard → Agent settings API: updates settings
- Mobile app → Agent API: manages agents
- Agent API → Database access: queries and writes
- Agent settings API → Database access: queries and writes
- Agent settings API → WhatsApp connector: sets webhook
- WhatsApp connector → WhatsApp service: controls sessions
- WhatsApp service → WhatsApp sessions: sends events
- WhatsApp sessions → Database access: reads and updates
- WhatsApp sessions → Push notifications: notifies owner
- WhatsApp sessions → Agent settings API: activates draft
- Customer → WhatsApp service: messages
- Conversation workflow → Catalog API: retrieves catalog
- Conversation workflow → Order API: submits order
- Order API → Database access: resolves session
- Order API → Order service: creates order
- Order service → Database access: persists order
- Web dashboard → Catalog API: manages catalog
- Web dashboard → Order management API: manages fulfillment
- Mobile app → Order management API: manages fulfillment
- Order management API → Database access: reads and updates
- Web dashboard → Courier APIs: tracks delivery
- Customer → Public commerce API: places or tracks order
- Public commerce API → Database access: accesses commerce data
- Web dashboard → Analytics API: views metrics
- Analytics API → Database access: queries metrics
- Analytics API → WhatsApp connector: fetches session analytics
- Web dashboard → Conversation analysis: analyzes conversations
- Conversation analysis → Database access: reads conversations
- Web dashboard → Complaints API: manages complaints
- Complaints API → Database access: reads and updates
- Complaints API → WhatsApp service: sends client message
- Database access → PostgreSQL data: queries
