Learn through a complete e-commerce implementation with Spring Boot & Java
Microservices
Design Patterns
Technologies
Circuit Breakers
Port: 8888
Technology: Spring Cloud Config
Database: File System
The Config Server acts as a centralized configuration management system for all microservices. It eliminates the need to rebuild and redeploy services when configuration changes.
Port: 8761
Technology: Netflix Eureka
Database: In-Memory Registry
The Discovery Service maintains a registry of all available microservice instances, enabling dynamic service-to-service communication without hardcoded URLs.
Port: 8222
Technology: Spring Cloud Gateway
Features: Routing, Load Balancing, Tracing
The API Gateway serves as the single entry point for all client requests, routing them to appropriate microservices while providing cross-cutting concerns.
/api/customers/** → Customer Service
/api/products/** → Product Service
/api/orders/** → Order Service
/api/payments/** → Payment Service
Database: MongoDB
Technology: Spring Data MongoDB
Pattern: Document Store
Manages all customer-related data and operations, storing flexible customer profiles in MongoDB for scalability and schema evolution.
Database: PostgreSQL
Technology: Spring Data JPA
Integration: OpenFeign, Kafka
Orchestrates the complete order lifecycle, integrating with multiple services to validate customers, check product availability, process payments, and trigger notifications.
Database: MongoDB
Technology: Kafka, Thymeleaf
Integration: Java Mail Sender
Handles all notification requirements using event-driven architecture. Listens to Kafka events and sends appropriate email notifications to customers.
Implementation: Netflix Eureka
Services automatically register themselves and discover other services dynamically.
Implementation: Spring Cloud Gateway
Single entry point for all client requests with routing and cross-cutting concerns.
Implementation: PostgreSQL + MongoDB
Each service owns its data and database, ensuring loose coupling.
Implementation: Apache Kafka
Services communicate through events for loose coupling and resilience.
Implementation: Spring Cloud Config
Configuration management separated from application code for flexibility.
Implementation: Zipkin
Track requests across multiple services for debugging and monitoring.
Implementation: Resilience4j
Prevents cascading failures by monitoring service calls and failing fast when downstream services are unavailable.
Implementation: Choreography + Orchestration
Manages distributed transactions across multiple services with compensation logic for rollback scenarios.
Recovery: Automatic timeout handling and retry mechanisms with exponential backoff
Before following the setup steps, clone the complete source code from GitHub:
git clone https://github.com/PramithaMJ/fully-completed-microservices.git
cd fully-completed-microservices
Repository: https://github.com/PramithaMJ/fully-completed-microservices
docker-compose up -d
This starts PostgreSQL, MongoDB, Kafka, Zipkin, and admin tools.
Start Customer, Product, Order, Payment, and Notification services in any order.
curl -X POST http://localhost:8222/api/customers \
-H "Content-Type: application/json" \
-d '{
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"address": {
"street": "123 Main St",
"houseNumber": "123",
"zipCode": "12345"
}
}'
curl -X POST http://localhost:8222/api/products \
-H "Content-Type: application/json" \
-d '{
"name": "MacBook Pro",
"description": "Apple MacBook Pro 16-inch",
"availableQuantity": 10,
"price": 2499.99
}'
curl -X POST http://localhost:8222/api/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer_id_here",
"products": [
{
"productId": "product_id_here",
"quantity": 1
}
],
"paymentMethod": "PAYPAL"
}'
Complete Kubernetes deployment manifests with Helm charts for production-ready deployment.
Zero-downtime deployment strategy with automated rollback capabilities for production environments.
# Install the complete microservices platform
helm install ecommerce-platform ./k8s/helm-charts \
--namespace microservices \
--create-namespace
# Verify deployment
kubectl get pods -n microservices
# Check services
kubectl get svc -n microservices
Deploy new version to green environment while blue serves production traffic
./k8s/blue-green-deploy.sh prepare-green v2.0.0
Automated health checks ensure green environment is ready for production
./k8s/blue-green-deploy.sh validate-green
Instantly switch production traffic from blue to green environment
./k8s/blue-green-deploy.sh switch-to-green
Instant rollback to blue environment if issues are detected
./k8s/blue-green-deploy.sh rollback-to-blue
# 1. Build and push Docker images
./k8s/build-images.sh
# 2. Deploy with Helm
helm install microservices ./k8s/helm-charts \
--namespace microservices \
--create-namespace \
--set global.environment=production
# 3. Access the application
kubectl port-forward svc/gateway-service 8222:8222 -n microservices
# 4. Monitor deployment
kubectl get all -n microservices
kubectl logs -f deployment/gateway-service -n microservices
Access the complete, production-ready microservices implementation with detailed documentation, configuration files, and step-by-step commit history.
Spring Boot Microservices Architecture