How kea-renov8/befly-gateway works
Project Type and Purpose
• This is a reactive API‐Gateway built with Kotlin and Spring Boot (WebFlux).
• Its role is to authenticate, authorize, log, and proxy client requests to downstream microservices via WebClient.
Components from the File Tree
a. Entry Point
• BeflyGatewayApplication.kt – main Spring Boot application.
b. Configuration
• GatewayConfig.kt – route definitions, path predicates, timeouts.
• SecurityConfig.kt – security filter chain, permitted paths.
• WebClientConfig.kt – WebClient beans for downstream calls.
c. Filters & Handlers
• JwtAuthenticationFilter.kt & RefreshAuthenticationFilter.kt – JWT validation and token refresh.
• LoggingFilter.kt – request/response logging.
• CustomAuthenticationEntryPoint.kt – error entry point.
• OAuth2SuccessHandler.kt – OAuth2 login success handling.
d. JWT Utilities
• JwtProvider.kt – issue/validate tokens.
e. DTOs & Error Codes
• Data transfer objects for login requests/responses, error responses.
• ErrorCode.kt – standardized error codes.
f. CI/CD & Docker
• Dockerfile.dev/prod – container images for environments.
• GitHub Actions workflows under .github/workflows for CI (build & test) and CD (deploy).
README Insights
• Confirms stacks: Kotlin, Spring WebFlux API Gateway.
1. Clients (blue)
• Mobile/Web Frontend
• External 3rd‐party services
2. API Gateway (green)
• HTTP Ingress Layer
• Filter Chain:
• Authentication/Authorization Filters
• Logging Filter
• Error Handler
• Routing Component (GatewayConfig)
• WebClient Pool (WebClientConfig)
• JWT Module (JwtProvider)
3. Downstream Services (orange)
• Auth Service
• User Service
• Orders Service (etc.)
• Docker Registry
• CI/CD Pipelines (GitHub Actions)
• Pipeline flow: Developer commit → GitHub Actions CI → Build & Test → Docker push → Deployment.
c. Architectural Patterns / Principles
• Gateway Pattern: central entry point for microservices.
• Filter Chain: modular cross‐cutting concerns (auth, logging, error handling).
• Reactive Non‐blocking I/O via Spring WebFlux and WebClient.
• Externalized Configuration via application.yml (not shown, but implied).