meldestelle/docs/07_Infrastructure/api-gateway.md
Stefan Mogeritsch f4563a3da3 docs: add new documentation for API Gateway, core model, and backend structure
Introduced detailed documentation for the API Gateway, including its configuration and responsibilities in the system (e.g., routing, security, and cross-cutting concerns). Added a README for the core model directory to define its structure and workflow. Created a new backend README to describe its components and their documentation structure. Simplified and clarified legacy specifications for archiving purposes.
2026-01-15 13:53:56 +01:00

1.2 KiB

Infrastruktur: API-Gateway

Dieses Dokument beschreibt die Konfiguration und die Aufgaben des API-Gateways im "Meldestelle"-Projekt.

Zweck

Das API-Gateway (implementiert mit Spring Cloud Gateway) ist der zentrale, nach außen exponierte Einstiegspunkt für alle HTTP-Anfragen an das System.

Seine Hauptaufgaben sind:

  • Routing: Leitet Anfragen an den korrekten Microservice weiter (z.B. /api/ping/** -> ping-service).
  • Security: Erzwingt die Authentifizierung und Autorisierung für alle eingehenden Anfragen. Es validiert die von Keycloak ausgestellten JWTs.
  • Cross-Cutting Concerns: Implementiert übergreifende Funktionalitäten wie Rate Limiting, Logging und Circuit Breaking (mit Resilience4j).

Konfiguration

Die Routen werden in der application.yml des Gateways definiert. Die Konfiguration für die Service Discovery erfolgt über Consul.

spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true
      routes:
        - id: ping-service
          uri: lb://ping-service
          predicates:
            - Path=/api/ping/**
          filters:
            - StripPrefix=2