E-commerce backend built with Java, Spring Boot and Microservices architecture.
Client
│
▼
┌─────────────────────┐
│ API Gateway │ ← Spring Cloud Gateway (port 8080)
└─────────┬───────────┘
│
┌─────┴──────┐
▼ ▼
┌────────┐ ┌────────┐
│Product │ │ Order │
│Service │ │Service │
│ :8081 │ │ :8082 │
└────────┘ └────────┘
│ │
MySQL SQL Server
◎ Eureka Server (port 8761)
All services registered
| Service | Port | Database | Description |
|---|---|---|---|
eureka-server |
8761 | — | Service Discovery |
api-gateway |
8080 | — | API Gateway & routing |
product-service |
8081 | MySQL | Product catalog management |
order-service |
8082 | SQL Server | Order processing |
- Java 17 + Spring Boot 4 + Spring Framework 7
- Spring Cloud Gateway — API Gateway with load balancing
- Netflix Eureka — Service Discovery
- OpenFeign — Declarative HTTP client for inter-service communication
- Resilience4j — Circuit Breaker pattern
- Flyway — Database migrations
- MySQL — Product Service database
- SQL Server — Order Service database
- Java 17+
- Maven
- MySQL running on port
3306 - SQL Server running on port
1433
Start in this exact order:
# 1. Eureka Server
cd eureka-server && mvn spring-boot:run
# 2. Product Service
cd product-service && mvn spring-boot:run
# 3. Order Service
cd order-service && mvn spring-boot:run
# 4. API Gateway
cd api-gateway && mvn spring-boot:runhttp://localhost:8761
All requests go through the API Gateway at http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
GET |
/products |
List all products |
GET |
/products/{id} |
Get product by ID |
POST |
/products |
Create product |
PUT |
/products/{id} |
Update product |
DELETE |
/products/{id} |
Delete product |
| Method | Endpoint | Description |
|---|---|---|
GET |
/orders |
List all orders |
GET |
/orders/{id} |
Get order by ID |
POST |
/orders |
Create order |
The Order Service communicates with the Product Service via Feign Client.
Errors are translated into domain exceptions by a custom ErrorDecoder:
404→ProductNotFoundException→ returns404to the client503→ProductServiceUnavailableException→ returns503to the client
- Circuit Breaker via Resilience4j protects inter-service calls
- Custom
GlobalExceptionHandlerensures consistent error responses across all services
{
"error": "Produto não encontrado com o id informado",
"status": 404,
"timestamp": "2026-03-10T09:54:00.000"
}- Service Discovery with Eureka
- API Gateway with Spring Cloud Gateway
- Inter-service communication with Feign Client
- Circuit Breaker with Resilience4j
- Database migrations with Flyway
- Redis caching
- Async messaging with RabbitMQ
- Docker Compose setup
- Distributed tracing with Zipkin
Made with ❤️ by Rafael Bessa