How ilinpetar/spring-cloud-service-discovery-and-api-gateway-demo works
Project Type and Purpose
• This is a minimal Spring Cloud microservices topology.
• Core purpose: demonstrate service registration/discovery (Eureka) and API routing (Spring Cloud Gateway) with two sample services.
File Structure
• Top-level directories:
• service-discovery – Eureka Server
• api-gateway – Spring Cloud Gateway
• service-one – Sample REST service A
• service-two – Sample REST service B
• docker-compose.yml for orchestrating all four services locally.
• Each subproject is a Spring Boot/Gradle service with its own Dockerfile.
Extract Important Details from the README
• Spring Cloud Netflix Eureka for service registry & client.
• Spring Cloud Gateway for API routing to registered services.
• Each service registers itself with Eureka and exposes REST endpoints.
Main Components & Their Responsibilities
a. Client (e.g., Browser, Postman) – initiates HTTP requests
b. API Gateway – single entry point; routes incoming requests to downstream services
c. Service Discovery (Eureka Server) – holds registry of service instances
d. Service One & Service Two – two independent Spring Boot REST microservices
e. (Optional) Docker Compose – orchestrates all containers for local deployment
Relationships & Data Flows
1) Client → API Gateway: HTTP request (e.g. GET /service-one/…)
2) API Gateway → Eureka Server: lookup service instance(s)
3) Eureka Server → API Gateway: returns service instance location
4) API Gateway → Target Service: forwards request to Service One or Two
5) Service → Eureka Server: on startup each service registers itself
6) (Optional) Services may call each other via API Gateway + Eureka
Key Architectural Patterns & Design Principles
• Microservices: independently deployable units
• Service Registry: Eureka provides dynamic discovery of service instances
• API Gateway Pattern: central routing, load-balancing, filters, security
• Spring Boot / Spring Cloud: opinionated frameworks for rapid service development
• Containerization: each service runs in its own Docker container
Technologies / Frameworks to Annotate
• Java 21, Spring Boot
• Spring Cloud Netflix (Eureka Server & Client)
• Spring Cloud Gateway
• Gradle 8, Docker, Docker Compose
Final Checklist for the Engineer
• [ ] All five runtime components shown (Client, Gateway, Eureka, Service One, Service Two)
• [ ] Labels for protocols (HTTP, REST) and ports if relevant
• [ ] Boundary or note showing Docker Compose orchestration