# blebelo/glass architecture

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

## Overview

GlassTickets is a multi-tenant support-ticket application with a Next.js agent dashboard and an ASP.NET Core backend. The principal inbound workflow documented for WhatsApp is webhook intake, message analysis, ticket creation and routing, then a reply to the customer; the webhook source confirms the controller-to-chat-service-to-Twilio call sequence. The dashboard also supports ticket and workforce management. README-described AI, real-time updates, and analytics have no clearly corresponding implementation in the supplied tree, so their wiring is not asserted; the graph uses documented capability links where applicable.

Main entry points: [`aspnet-core/src/GlassTickets.Web.Host/Controllers/WhatsappWebHookController.cs`](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Web.Host/Controllers/WhatsappWebHookController.cs) (WhatsApp webhook), [`aspnet-core/src/GlassTickets.Application/Services/Whatsapp/WhatsappChatAppService.cs`](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Whatsapp/WhatsappChatAppService.cs) (WhatsApp chat service), [`aspnet-core/src/GlassTickets.Application/Services/Tickets/TicketAppService.cs`](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Tickets/TicketAppService.cs) (Ticket application service), [`aspnet-core/src/GlassTickets.Application/Services/Twilio/TwilioService.cs`](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Twilio/TwilioService.cs) (Twilio messaging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inbound["WhatsApp intake"]
  node_webhook["WhatsApp webhook"]
  node_chat["WhatsApp chat service"]
  node_draft["Ticket draft<br/>[TicketDraftDto.cs]"]
  node_twilio["Twilio messaging<br/>[TwilioService.cs]"]
  node_ai["AI message analysis"]
end

subgraph group_ticketing["Ticket operations"]
  node_tickets["Ticket application service"]
  node_tracking["Ticket tracking"]
  node_employee_service["Employee management"]
  node_employee_domain["Employee domain<br/>[EmployeeManager.cs]"]
  node_supervisor["Supervisor management"]
end

subgraph group_dashboard["Agent dashboard"]
  node_web_client["Next.js dashboard<br/>[page.tsx]"]
  node_ticket_provider["Ticket state provider<br/>[index.tsx]"]
  node_assign_modal["Assignment dialog"]
  node_auth_ui["Authentication provider<br/>[index.tsx]"]
end

subgraph group_identity["Identity and tenancy"]
  node_auth_controller["Token authentication"]
  node_login_manager["Login manager<br/>[LoginManager.cs]"]
  node_registration["User registration"]
  node_tenant_manager["Tenant manager<br/>[TenantManager.cs]"]
end

subgraph group_persistence["Persistence"]
  node_db[("Application database")]
end

node_customer(("WhatsApp customer"))
node_twilio_api["Twilio"]
node_dashboard_user(("Agent or supervisor"))
node_openai["OpenAI API"]

node_customer -->|"sends message"| node_webhook
node_webhook -->|"handles message"| node_chat
node_chat -.->|"analyzes message"| node_ai
node_ai -.->|"uses AI"| node_openai
node_chat -.->|"creates ticket"| node_tickets
node_webhook -->|"sends reply"| node_twilio
node_twilio -->|"sends WhatsApp"| node_twilio_api
node_dashboard_user -->|"manages tickets"| node_web_client
node_web_client -->|"uses state"| node_ticket_provider
node_ticket_provider -.->|"requests tickets"| node_tickets
node_assign_modal -.->|"selects assignee"| node_employee_service
node_employee_service -->|"creates employee"| node_employee_domain
node_auth_ui -.->|"authenticates"| node_auth_controller
node_auth_controller -->|"checks credentials"| node_login_manager
node_registration -->|"validates tenant"| node_tenant_manager
node_tickets -.->|"persists tickets"| node_db
node_employee_domain -.->|"persists employee"| node_db

click node_webhook "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Web.Host/Controllers/WhatsappWebHookController.cs"
click node_chat "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Whatsapp/WhatsappChatAppService.cs"
click node_draft "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Whatsapp/Dto/TicketDraftDto.cs"
click node_twilio "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Twilio/TwilioService.cs"
click node_tickets "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Tickets/TicketAppService.cs"
click node_tracking "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/TicketTracking/TicketTrackingService.cs"
click node_employee_service "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Employees/EmployeeAppService.cs"
click node_employee_domain "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Domain/Employees/EmployeeManager.cs"
click node_supervisor "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Supervisors/SupervisorAppService.cs"
click node_web_client "https://github.com/blebelo/glass/blob/main/nextts/src/app/dashboard/page.tsx"
click node_ticket_provider "https://github.com/blebelo/glass/blob/main/nextts/src/providers/ticket-provider/index.tsx"
click node_assign_modal "https://github.com/blebelo/glass/blob/main/nextts/src/components/modals/ticketModals/AssignEmployeeModal.tsx"
click node_auth_ui "https://github.com/blebelo/glass/blob/main/nextts/src/providers/auth-provider/index.tsx"
click node_auth_controller "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Web.Core/Controllers/TokenAuthController.cs"
click node_login_manager "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Authorization/LoginManager.cs"
click node_registration "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Authorization/Users/UserRegistrationManager.cs"
click node_tenant_manager "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/MultiTenancy/TenantManager.cs"
click node_db "https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.EntityFrameworkCore/EntityFrameworkCore/GlassTicketsDbContext.cs"

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_webhook,node_chat,node_draft,node_twilio,node_ai toneBlue
class node_tickets,node_tracking,node_employee_service,node_employee_domain,node_supervisor toneAmber
class node_web_client,node_ticket_provider,node_assign_modal,node_auth_ui,node_openai toneMint
class node_auth_controller,node_login_manager,node_registration,node_tenant_manager toneRose
class node_db,node_customer,node_twilio_api,node_dashboard_user toneIndigo
```

## Components

### WhatsApp intake

- [WhatsApp webhook](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Web.Host/Controllers/WhatsappWebHookController.cs): `aspnet-core/src/GlassTickets.Web.Host/Controllers/WhatsappWebHookController.cs`
- [WhatsApp chat service](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Whatsapp/WhatsappChatAppService.cs): `aspnet-core/src/GlassTickets.Application/Services/Whatsapp/WhatsappChatAppService.cs`
- [Ticket draft](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Whatsapp/Dto/TicketDraftDto.cs): `aspnet-core/src/GlassTickets.Application/Services/Whatsapp/Dto/TicketDraftDto.cs`
- [Twilio messaging](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Twilio/TwilioService.cs): `aspnet-core/src/GlassTickets.Application/Services/Twilio/TwilioService.cs`
- **AI message analysis**

### Ticket operations

- [Ticket application service](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Tickets/TicketAppService.cs): `aspnet-core/src/GlassTickets.Application/Services/Tickets/TicketAppService.cs`
- [Ticket tracking](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/TicketTracking/TicketTrackingService.cs): `aspnet-core/src/GlassTickets.Application/Services/TicketTracking/TicketTrackingService.cs`
- [Employee management](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Employees/EmployeeAppService.cs): `aspnet-core/src/GlassTickets.Application/Services/Employees/EmployeeAppService.cs`
- [Employee domain](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Domain/Employees/EmployeeManager.cs): `aspnet-core/src/GlassTickets.Core/Domain/Employees/EmployeeManager.cs`
- [Supervisor management](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Application/Services/Supervisors/SupervisorAppService.cs): `aspnet-core/src/GlassTickets.Application/Services/Supervisors/SupervisorAppService.cs`

### Agent dashboard

- [Next.js dashboard](https://github.com/blebelo/glass/blob/main/nextts/src/app/dashboard/page.tsx): `nextts/src/app/dashboard/page.tsx`
- [Ticket state provider](https://github.com/blebelo/glass/blob/main/nextts/src/providers/ticket-provider/index.tsx): `nextts/src/providers/ticket-provider/index.tsx`
- [Assignment dialog](https://github.com/blebelo/glass/blob/main/nextts/src/components/modals/ticketModals/AssignEmployeeModal.tsx): `nextts/src/components/modals/ticketModals/AssignEmployeeModal.tsx`
- [Authentication provider](https://github.com/blebelo/glass/blob/main/nextts/src/providers/auth-provider/index.tsx): `nextts/src/providers/auth-provider/index.tsx`

### Identity and tenancy

- [Token authentication](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Web.Core/Controllers/TokenAuthController.cs): `aspnet-core/src/GlassTickets.Web.Core/Controllers/TokenAuthController.cs`
- [Login manager](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Authorization/LoginManager.cs): `aspnet-core/src/GlassTickets.Core/Authorization/LoginManager.cs`
- [User registration](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/Authorization/Users/UserRegistrationManager.cs): `aspnet-core/src/GlassTickets.Core/Authorization/Users/UserRegistrationManager.cs`
- [Tenant manager](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.Core/MultiTenancy/TenantManager.cs): `aspnet-core/src/GlassTickets.Core/MultiTenancy/TenantManager.cs`

### Persistence

- [Application database](https://github.com/blebelo/glass/blob/main/aspnet-core/src/GlassTickets.EntityFrameworkCore/EntityFrameworkCore/GlassTicketsDbContext.cs): `aspnet-core/src/GlassTickets.EntityFrameworkCore/EntityFrameworkCore/GlassTicketsDbContext.cs`

### Other components

- **WhatsApp customer**
- **Twilio**
- **Agent or supervisor**
- **OpenAI API**

## Connections

- WhatsApp customer → WhatsApp webhook: sends message
- WhatsApp webhook → WhatsApp chat service: handles message
- WhatsApp chat service → AI message analysis: analyzes message
- AI message analysis → OpenAI API: uses AI
- WhatsApp chat service → Ticket application service: creates ticket
- WhatsApp webhook → Twilio messaging: sends reply
- Twilio messaging → Twilio: sends WhatsApp
- Agent or supervisor → Next.js dashboard: manages tickets
- Next.js dashboard → Ticket state provider: uses state
- Ticket state provider → Ticket application service: requests tickets
- Assignment dialog → Employee management: selects assignee
- Employee management → Employee domain: creates employee
- Authentication provider → Token authentication: authenticates
- Token authentication → Login manager: checks credentials
- User registration → Tenant manager: validates tenant
- Ticket application service → Application database: persists tickets
- Employee domain → Application database: persists employee
