MATIH Platform is in active MVP development. Documentation reflects current implementation status.
2. Architecture
Overview

Request Lifecycle and Data Flow Overview

Every user interaction with the MATIH Platform follows a well-defined path through multiple system layers. This section traces the complete lifecycle of five key request flows, from browser to database and back. Understanding these flows is essential for debugging, performance optimization, and architectural reasoning.


Five Key Flows

FlowStarts AtKey ServicesTypical Latency
Browser to GatewayBrowserKong Gateway, IAM Service2-200ms
Query FlowBI WorkbenchQuery Engine, Trino, Semantic Layer50-5000ms
Agent FlowAgentic WorkbenchAI Service, Query Engine, Catalog1-8 seconds
Pipeline FlowData WorkbenchPipeline Service, Temporal, Spark/FlinkMinutes to hours
ML FlowML WorkbenchML Service, Ray, MLflow, FeastMinutes to hours

The Canonical Request Path

Every authenticated request follows this fundamental path through the platform:

Browser
  |
  v
Kong API Gateway (Port 8080)
  | 1. Input validation
  | 2. JWT validation and claims extraction
  | 3. Rate limit check
  | 4. Route matching
  |
  v
Backend Service
  | 5. SecurityFilter (attack detection)
  | 6. JwtAuthenticationFilter (token re-validation)
  | 7. TenantContextFilter (context establishment)
  | 8. Controller (request handling)
  | 9. Service layer (business logic)
  | 10. Repository (database access with tenant scope)
  |
  v
Response
  | 11. Serialize response
  | 12. Add security headers
  | 13. Return through gateway
  |
  v
Browser

Request Tracing

Every request is traceable end-to-end through two identifiers:

IdentifierSet ByPurpose
X-Request-IDKong GatewayUnique per-request identifier
X-Correlation-IDKong Gateway or clientGroups related requests across services

These identifiers are propagated through HTTP headers, Kafka event headers, structured log entries, and OpenTelemetry span attributes.


Data Flow Patterns

PatternDescriptionUsed By
Read-through cacheCheck Redis before querying PostgreSQLCatalog, semantic models, config
Write-behind eventWrite to database, then publish Kafka eventAll state-changing operations
Streaming responseServer-Sent Events for token-by-token AI outputAI Service chat endpoints
Fan-out eventOne event triggers multiple consumer actionsAudit, billing, notifications

Related Sections