import type { SystemInfoConfig } from './types'
export const middlewareConfig: SystemInfoConfig = {
title: 'Middleware System-Info',
description: 'Middleware-Stack mit Test-Wizard fuer Integration Tests.',
version: '1.5',
architecture: {
layers: [
{ title: 'Test Wizard UI', components: ['Test Runner', 'Result Viewer', 'Coverage Report'], color: '#3b82f6' },
{ title: 'API Gateway', components: ['Traefik', 'Rate Limiter', 'Auth Proxy'], color: '#8b5cf6' },
{ title: 'Services', components: ['Consent', 'Klausur', 'School', 'Backend'], color: '#10b981' },
{ title: 'Infrastructure', components: ['PostgreSQL', 'Valkey', 'MinIO', 'Qdrant'], color: '#f59e0b' },
],
},
features: [
{ name: 'Integration Tests', status: 'active', description: 'End-to-End API Tests' },
{ name: 'Health Checks', status: 'active', description: 'Service-Status Pruefung' },
{ name: 'Test Wizard', status: 'active', description: 'Interaktive Test-Suite' },
{ name: 'Load Testing', status: 'planned', description: 'Performance-Tests' },
{ name: 'Chaos Engineering', status: 'planned', description: 'Resilienz-Tests' },
],
roadmap: [
{ phase: 'Phase 1: Testing (Q1)', priority: 'high', items: ['API Test Suite', 'Database Tests', 'Auth Flow Tests', 'Error Handling Tests'] },
{ phase: 'Phase 2: Performance (Q2)', priority: 'medium', items: ['k6 Load Tests', 'Latency Benchmarks', 'Throughput Tests', 'Memory Profiling'] },
{ phase: 'Phase 3: Resilience (Q3)', priority: 'low', items: ['Chaos Monkey', 'Failover Tests', 'Circuit Breaker', 'Graceful Degradation'] },
],
technicalDetails: [
{ component: 'API Gateway', technology: 'Traefik', version: '3.x', description: 'Reverse Proxy' },
{ component: 'Cache', technology: 'Valkey', version: '8.x', description: 'In-Memory Store' },
{ component: 'Storage', technology: 'MinIO', version: 'Latest', description: 'S3-kompatibel' },
{ component: 'Vector DB', technology: 'Qdrant', version: '1.12+', description: 'Similarity Search' },
],
auditInfo: [
{
category: 'Service Health',
items: [
{ label: 'API Gateway (Traefik)', value: 'Online', status: 'ok' },
{ label: 'PostgreSQL', value: 'Online', status: 'ok' },
{ label: 'Valkey (Cache)', value: 'Online', status: 'ok' },
{ label: 'Qdrant', value: 'Online', status: 'ok' },
],
},
{
category: 'Test Coverage',
items: [
{ label: 'Integration Tests', value: 'Aktiv', status: 'ok' },
{ label: 'Auth Flow Tests', value: 'Implementiert', status: 'ok' },
{ label: 'Load Tests', value: 'Geplant', status: 'warning' },
{ label: 'Chaos Tests', value: 'Geplant', status: 'warning' },
],
},
{
category: 'Performance',
items: [
{ label: 'Avg. Response Time', value: '< 100ms', status: 'ok' },
{ label: 'Uptime (30 Tage)', value: '> 99.9%', status: 'ok' },
{ label: 'Error Rate', value: '< 0.1%', status: 'ok' },
{ label: 'Cache Hit Ratio', value: '> 90%', status: 'ok' },
],
},
],
fullDocumentation: `
Middleware & Integration Testing
1. Uebersicht
Das Middleware-Modul verwaltet den gesamten Service-Stack und bietet einen Test-Wizard fuer Integration Tests. Es stellt sicher, dass alle Services korrekt miteinander kommunizieren.
2. Service-Architektur
┌─────────────────────────────────────────────────────────────────────┐
│ Traefik Gateway │
│ ├── TLS Termination │
│ ├── Rate Limiting │
│ ├── Request Routing │
│ └── Health Checks │
└────────────────────────────────┬────────────────────────────────────┘
│
┌──────────────────────┼──────────────────────┐
│ │ │
v v v
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Website (3000) │ │ Backend (8000) │ │ Consent (8081) │
│ Next.js │ │ FastAPI │ │ Gin │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
└──────────────────┬──┴─────────────────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
v v v
┌─────────────────┐ ┌────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ Valkey │ │ Qdrant │
│ (5432) │ │ (6379) │ │ (6333) │
└─────────────────┘ └────────────┘ └─────────────────┘
3. Test-Wizard Funktionen
| Test-Kategorie | Beschreibung | Status |
| Health Checks | Service-Erreichbarkeit | Automatisch |
| Auth Flow | Login, Token-Refresh, Logout | Implementiert |
| Consent CRUD | Dokumente erstellen, lesen, aktualisieren | Implementiert |
| Database | Connection Pool, Query Performance | Implementiert |
| Cache | Set/Get, Invalidierung | Implementiert |
| Vector Search | Embedding, Similarity Search | Implementiert |
4. API Endpoints
| Endpoint | Methode | Beschreibung |
| /api/middleware/health | GET | Alle Service Health Checks |
| /api/middleware/tests | GET | Verfuegbare Test-Suites |
| /api/middleware/tests/run | POST | Test-Suite ausfuehren |
| /api/middleware/metrics | GET | Performance-Metriken |
5. Health Check Format
{
"status": "healthy",
"timestamp": "2025-01-14T10:00:00Z",
"services": {
"postgres": {
"status": "up",
"latency_ms": 2,
"details": {"connections": 10, "max": 100}
},
"valkey": {
"status": "up",
"latency_ms": 1,
"details": {"memory_used": "50MB"}
},
"qdrant": {
"status": "up",
"latency_ms": 5,
"details": {"collections": 3}
}
}
}
6. Test-Ausfuehrung
Test Request
│
v
┌───────────────────────────────────────┐
│ Test Runner Engine │
├───────────────────────────────────────┤
│ 1. Setup (Fixtures, Test Data) │
│ 2. Execute (Sequential/Parallel) │
│ 3. Assert (Expected vs Actual) │
│ 4. Cleanup (Remove Test Data) │
│ 5. Report (Results, Timings) │
└───────────────────────────────────────┘
│
v
┌───────────────────────────────────────┐
│ Test Report │
│ ├── Total: 25, Passed: 24, Failed: 1 │
│ ├── Duration: 5.2s │
│ └── Details per Test Case │
└───────────────────────────────────────┘
7. Rate Limiting
| Endpoint-Typ | Limit | Window |
| Public API | 100 req | 1 Minute |
| Authenticated API | 1000 req | 1 Minute |
| Admin API | 5000 req | 1 Minute |
| File Upload | 10 req | 1 Minute |
8. Caching-Strategie
- Session Cache: 15 Min TTL, User-Tokens
- API Response Cache: 5 Min TTL, GET-Requests
- Config Cache: 1 Stunde TTL, System-Konfiguration
- Invalidierung: Event-basiert bei Datenänderung
9. Monitoring & Alerts
| Alert | Schwelle | Aktion |
| Service Down | 3 failed checks | PagerDuty, Slack |
| High Latency | > 500ms avg | Slack |
| High Error Rate | > 1% | Slack |
| DB Connections High | > 80% | E-Mail |
10. Troubleshooting
Problem: Service nicht erreichbar
├── Check: Docker Container Status
├── Check: Port-Mapping
├── Check: Network (docker network ls)
└── Check: Logs (docker logs service-name)
Problem: Hohe Latenz
├── Check: Database Query Performance
├── Check: Cache Hit Ratio
├── Check: CPU/Memory Usage
└── Check: Network Latency
`,
}