Project goal
The primary goal of this project was to explore production-style microservices architecture using the Spring Cloud ecosystem instead of building a traditional monolithic backend application.
The platform separates business domains such as products, inventory, orders and authentication into isolated services with their own persistence layers and deployment boundaries. This allows services to scale and evolve independently while still communicating through centralized gateway routing and secure APIs.
Architecture overview
The system uses Spring Cloud Gateway as the main entry point for all client requests. Incoming traffic is routed dynamically to internal services registered in Eureka.
Each service is independently deployable and owns its own database schema. MongoDB is used for flexible product catalog structures, while MySQL handles transactional order and inventory data.
Authentication and authorization are managed through Keycloak using OAuth2 and JWT access tokens. The gateway acts as a resource server and validates tokens before forwarding requests to downstream services.
Key technical features
- Spring Cloud Gateway with centralized route management
- Eureka service registry for dynamic service discovery
- OAuth2 authentication and JWT token validation with Keycloak
- Resilience4j circuit breakers and fallback handlers
- Distributed tracing using Zipkin and Spring Cloud Sleuth
- Dedicated databases per microservice
- WebClient-based non-blocking inter-service communication
- Role-based access control at gateway and service level
Technical challenges
One of the key challenges was designing reliable communication between services while avoiding tight coupling. The project explores resilience patterns including retry logic, fallback responses and circuit breakers for degraded downstream services.
Another focus area was observability. Distributed tracing was implemented to track request flow across services and simplify debugging of asynchronous or multi-step operations in a distributed environment.
The authentication layer also required careful configuration to ensure that OAuth2 token validation, route authorization and service-level security remained consistent across the platform.
Technology stack
Java, Spring Boot, Spring Cloud Gateway, Spring Cloud LoadBalancer, Eureka, Keycloak, Resilience4j, MongoDB, MySQL, Zipkin, Spring Security, OAuth2 and Docker.
Repository
Source code and implementation details are available on GitHub.
View on GitHub →