How moyu-x/whitebird works
Main Components
• Microservices:
– whitebird-auth-service (handles authentication & OAuth2 configurations; see its multiple config classes, controllers, and OAuth2 setups)
– whitebird-account-service (deals with user accounts, user roles, and permissions with its controllers, entities, repository and service layers)
– whitebird-config-service (serves as a distributed configuration provider for all services; note its dedicated “config” folder and YAML files)
– whitebird-demo-service (a demo or sandbox service to try out functionality)
– whitebird-gateway-service (acts as an API gateway that provides routing, filtering, rate limiting, and logging)
– whitebird-spring-boot-admin-service (provides operational monitoring and administration, indicated by its distinct port)
– whitebird-elasticsearch-demo (a demo module for Elasticsearch features)
• Common Libraries (whitebird-commons):
– These include various Spring Boot starters such as:
▪ whitebird-core-spring-boot-starter
▪ whitebird-jpa-spring-boot-starter
▪ whitebird-oauth2-spring-boot-starter
▪ whitebird-redis-spring-boot-starer
▪ whitebird-swagger-spring-boot-starter
▪ whitebird-web-spring-boot-starter and even a webflux starter
– These shared modules suggest code reuse and cross-cutting concerns (e.g., security, persistence, caching, and API documentation) across services
• Configuration Repository:
– The whitebird-config-folder contains per-service configuration YAML files that the config service will read and serve during runtime.
• Deployment & Infrastructure:
– The whitebird-deploy-file directory contains docker-compose and Prometheus configuration files that hint at container orchestration and monitoring.
Out Relationships and Interactions
• The Gateway then routes requests to the appropriate microservices such as account, auth, or demo services.
• The auth-service (using OAuth2) is central for token handling and client credentials. It might provide tokens that gateway and other services validate.
• The account-service, with its REST controllers and data access layers, handles user management. It likely communicates with a relational database (implied by Flyway migrations in the “db/migration” directories) and uses JPA configurations provided by the common “jpa-spring-boot-starter.”
• The config-service plays a supporting role, providing centralized configuration settings (distributed configuration pattern) to other services.
• The spring-boot-admin-service provides monitoring and health checks across the microservices and might have a bidirectional communication with each service for status updates.
• The Elasticsearch demo service demonstrates integration with external search capabilities and could be depicted interacting with an external Elasticsearch cluster.
Architectural Patterns and Technologies
• The overall architecture is based on microservices — each service is developed, deployed, and scaled independently.
• Notice the use of Spring Boot and related modules for web (MVC/REST), security (OAuth2), data persistence (JPA), caching (Redis), API documentation (Swagger), and even reactive programming (via webflux).
• The project uses Gradle as the build tool; Docker (via Jib and docker-compose) for containerization; external monitoring (Prometheus) for observability.
• Service-to-service communication is implicit between the gateway, auth, and other downstream services. Any API clients (e.g., WhitebirdUserClient in auth-service) can be denoted, illustrating inter-service REST or Feign calls.