How arivan-amin/clean-architecture-microservices works
Project Type and Purpose
• The project is a modern microservices back-end solution built using Java and Spring Boot.
• It follows Clean Architecture principles and implements best practices such as CQRS, AOP for audit logging, centralized error handling (via RestControllerAdvice), and service discovery.
• The system is designed to serve as a clean template for microservices with components for API gateway, service discovery, patient management, audit logging, SSO (authentication), notifications, and a shared Core module.
File Structure Indicators
• Top-level directories represent distinct microservices: Api-Gateway, Audit-Service, Core, Discovery-Server, Notification-Service, Patient-Service, and SSO-Service.
• The consistent package naming (com.arivanamin.healthcare/backend/…) and separation into subdirectories (application, core, endpoints, storage, configuration) show that each service has its own clean layering.
• Presence of Docker, docker-compose.yml, and additional directories for Grafana and keycloak indicate an environment with extra external components like authentication servers and monitoring tools.
• Testing and architectural rule-checking (ArchUnit tests) are also incorporated, which reinforces the adherence to strict architectural boundaries.
Read the README for Impactful Architectural Insights
• The README highlights key system components and the overall data flow: Clients communicate with the API Gateway (secured with rate limiting and security configurations) which in turn communicates with backend services.
• A discovery server (using Eureka) provides dynamic registration of services.
• Audit logging is implemented using Spring AOP to intercept API calls and then send events via Kafka to the Audit Service.
• External components include Keycloak for authentication, MySQL and optionally MongoDB for persistence, and observability tools like Grafana, Prometheus, log systems, and tracing through Tempo.
• Architectural patterns such as CQRS (splitting commands versus queries) and separation of core entities from persistence-specific annotations are clearly in use.
a. Main Components:
• External Clients: Represent user agents (web/mobile/other systems).
• API Gateway: The central entry point for client requests.
• Discovery Server (Eureka): Handles dynamic service registration and discovery.
• Microservices: Include Patient Service, Audit Service, SSO Service, and Notification Service (with Core module supporting shared utilities).
• External Systems: Keycloak (Auth Server), Message Broker (Kafka for event-driven communication), persistence databases (MySQL for transactional data, MongoDB for audit logs), and monitoring tools (Grafana, Prometheus, Loki, Tempo).
b. Relationships and Interactions:
• API Gateway forwarding authenticated requests to different back-end services.
• Registration of microservices with the Discovery Server.
• External systems like Keycloak with API Gateway and SSO Service for authentication/authorization.
• Monitoring flows from services (and Docker volumes) to Grafana, Prometheus, etc.
c. Highlighting Architectural Patterns:
d. Relevant Technologies:
• Mention that the Core module provides shared configurations, domain entities, and utilities used across services.
Final Detailing
• Provide detailed labels including technology names (Java, Spring Boot, Maven, Docker) and responsibilities (e.g., API Gateway handles security and rate-limiting, Audit Service captures events via Kafka).