Ticket Masala - Architecture Summary¶
Quick Reference Guide | See Detailed Architecture for full documentation.
Architecture at a Glance¶
Type: Modular Monolith with AI Augmentation
Stack: ASP.NET Core MVC + EF Core + ML.NET
Universal Entity Model Terminology¶
The system uses a layered terminology strategy to balance external API consistency with internal code stability.
| UEM (Public API) | Internal Code | Description |
|---|---|---|
| WorkItem | Ticket |
Individual work unit to be processed |
| WorkContainer | Project |
Collection of related work items |
| WorkHandler | ApplicationUser |
Person responsible for work |
API Routes: Both
/api/v1/ticketsand/api/v1/workitemsare supported.Views: Labels are domain-configurable via
masala_domains.yaml→entity_labels.
See ADR-001 for full rationale.
Key Design Patterns¶
| Pattern | Purpose | Location |
|---|---|---|
| Observer | Event-driven notifications | Observers/ |
| Repository + UoW | Data access abstraction | Repositories/ |
| Specification | Reusable queries | Repositories/Specifications/ |
| Strategy | Swappable AI algorithms | Services/GERDA/ |
| Facade | AI subsystem orchestration | GerdaService |
| Factory | Object creation | TicketFactory |
Request Lifecycle¶
Understanding how a request flows through the system:
sequenceDiagram
participant Client
participant Gatekeeper
participant Resolver as Tenant Resolver
participant Controller
participant Service
participant GERDA
participant Repository
participant DB as Database
Client->>Gatekeeper: HTTP Request
Gatekeeper->>Gatekeeper: Validate API Key
Gatekeeper->>Resolver: Forward Request
Resolver->>Resolver: Extract Tenant Context<br/>(subdomain/header)
Resolver->>Controller: Request + TenantId
Controller->>Service: Business Logic Call
Service->>Repository: Query/Command
Repository->>DB: EF Core Query
DB-->>Repository: Data
Repository-->>Service: Entity
Service->>GERDA: AI Processing (async)
GERDA-->>Service: Recommendations
Service-->>Controller: DTO
Controller-->>Client: JSON Response
Key Steps:
- Gatekeeper: API authentication and rate limiting
- Tenant Resolver: Extracts tenant context from subdomain or header
- Controller: Routes to appropriate service
- Service: Executes business logic
- GERDA: AI processing (non-blocking via observers)
- Repository: Data access abstraction
Detailed Design¶
Modular Monolith¶
The system is designed as a modular monolith, balancing simplicity and scalability. Each module is self-contained, with clear boundaries and responsibilities.
Key Modules¶
- Presentation Layer: Handles user interactions.
- Service Layer: Contains business logic.
- Repository Layer: Manages data access.
- AI Layer: Implements GERDA strategies.
GERDA AI Modules¶
| Letter | Module | Technique |
|---|---|---|
| G | Grouping | K-Means (spam detection) |
| E | Estimating | Classification (effort) |
| R | Ranking | WSJF (priority) |
| D | Dispatching | Matrix Factorization (agent matching) |
| A | Anticipation | Time Series (forecast) |
Service Architecture (CQRS-lite)¶
| Interface | Responsibility |
|---|---|
ITicketQueryService |
Read operations |
ITicketCommandService |
Write operations |
ITicketFactory |
Ticket creation |
Quick Start for Developers¶
Program.cs→ DI setupDbSeeder.cs→ Loads sample data fromconfig/seed_data.jsonTicketService.cs→ Business logicGerdaService.cs→ AI hub
Key Decisions¶
| Decision | Rationale |
|---|---|
| Local ML.NET | GDPR privacy, no API costs |
| Modular Monolith | Simpler ops than microservices |
| Observer Pattern | AI processing doesn't slow UI |
| Repository Pattern | Testable, database-agnostic |
Full details: Detailed Architecture