Modern e-commerce platform built with Spring Cloud microservices architecture.
- Architecture
- Tech Stack
- Services
- Getting Started
- Docker Compose
- Kubernetes Deployment
- API Documentation
- Project Structure
- License
This project follows a microservices architecture pattern with the following components:
┌─────────────────┐
│ API Gateway │
│ (Port 8080) │
└────────┬────────┘
│
┌───────────────────────┼───────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Service │ │ Product Service │ │ Order Service │
│ (Port 8700) │ │ (Port 8500) │ │ (Port 8300) │
└────────┬────────┘ └───────┬─────────┘ └────────┬────────┘
│ │ │
│ │ │
└───────────────────────┼─────────────────────────────┘
│
┌────────────┴──────────┐
│ Service Discovery │
│ (Eureka - 8761) │
└───────────────────────┘
| Component | Port | Description |
|---|---|---|
| API Gateway | 8080 | Entry point for all client requests |
| Service Discovery | 8761 | Eureka server for service registration |
| Cloud Config | 9296 | Centralized configuration management |
| Zipkin | 9411 | Distributed tracing |
| User Service | 8700 | User management and authentication |
| Product Service | 8500 | Product catalog management |
| Order Service | 8300 | Order processing |
| Payment Service | 8400 | Payment processing |
| Shipping Service | 8600 | Shipping management |
| Favourite Service | 8800 | Customer favorites |
| Proxy Client | 8900 | Client proxy service |
- Framework: Spring Boot 3.3.3
- Cloud: Spring Cloud 2023.0.3
- Java Version: 17+
- Service Discovery: Netflix Eureka
- API Gateway: Spring Cloud Gateway
- Configuration: Spring Cloud Config
- Circuit Breaker: Resilience4j
- Observability: Micrometer + Zipkin + Prometheus
- API Documentation: Springdoc OpenAPI
- Testing: TestContainers
- Containerization: Docker, Docker Compose
- Orchestration: Kubernetes
-
Service Discovery (
service-discovery/)- Netflix Eureka Server
- Service registration and discovery
- Port: 8761
-
Cloud Config Server (
cloud-config/)- Centralized configuration management
- Port: 9296
-
API Gateway (
api-gateway/)- Request routing and filtering
- Authentication and authorization
- Rate limiting
- Port: 8080
-
User Service (
user-service/)- User authentication and authorization
- User profile management
- Address management
- Credentials management
- Port: 8700
-
Product Service (
product-service/)- Product catalog management
- Category management
- Product search and filtering
-
Order Service (
order-service/)- Order processing
- Order history
- Order status tracking
-
Payment Service (
payment-service/)- Payment processing
- Payment methods management
-
Shipping Service (
shipping-service/)- Shipping information
- Delivery tracking
-
Favourite Service (
favourite-service/)- Customer favorites/wishlists
- Product preferences
-
Proxy Client (
proxy-client/)- Client proxy service
- Inter-service communication
- Java 17 or higher
- Maven 3.8+
- Docker (optional)
- Kubernetes (optional, for K8s deployment)
# Build the parent project
./mvnw clean install -DskipTests
# Or build individual services
cd <service-directory>
./mvnw clean package -DskipTestsEach service can be run independently:
# Service Discovery
cd service-discovery
./mvnw spring-boot:run
# Cloud Config
cd cloud-config
./mvnw spring-boot:run
# API Gateway
cd api-gateway
./mvnw spring-boot:run
# Other services...Start all services using Docker Compose:
# Build and start all services
docker-compose up --build
# Or start in detached mode
docker-compose up -dThe services start in the following order:
- zipkin - Distributed tracing server
- cloud-config - Configuration server
- service-discovery - Eureka service registry
- proxy-client - Client proxy service
- user-service - User management
- product-service - Product catalog
- order-service - Order management
- payment-service - Payment processing
- shipping-service - Shipping management
- favourite-service - Customer favorites
- api-gateway - API entry point
| Service | URL |
|---|---|
| API Gateway | http://localhost:8080 |
| Service Discovery | http://localhost:8761 |
| Cloud Config | http://localhost:9296 |
| Zipkin | http://localhost:9411 |
| User Service | http://localhost:8700 |
| Product Service | http://localhost:8500 |
| Order Service | http://localhost:8300 |
| Payment Service | http://localhost:8400 |
| Shipping Service | http://localhost:8600 |
| Favourite Service | http://localhost:8800 |
Deploy to Kubernetes using the provided manifests:
# Apply all Kubernetes manifests
kubectl apply -f k8s/The following services are configured for Kubernetes deployment:
api-gateway/cloud-config/service-discovery/user-service/product-service/order-service/payment-service/shipping-service/favourite-service/proxy-client/zipkin/
Each service provides OpenAPI/Swagger documentation:
- API Gateway: http://localhost:8080/swagger-ui.html
- User Service: http://localhost:8700/swagger-ui.html
- Product Service: http://localhost:8500/swagger-ui.html
- And more...
mark-ecommerce-spring-boot/
├── api-gateway/ # API Gateway service
├── cloud-config/ # Cloud Config Server
├── service-discovery/ # Eureka Service Registry
├── user-service/ # User management
├── product-service/ # Product catalog
├── order-service/ # Order processing
├── payment-service/ # Payment processing
├── shipping-service/ # Shipping management
├── favourite-service/ # Customer favorites
├── proxy-client/ # Client proxy
├── api-requests/ # HTTP client requests
├── k8s/ # Kubernetes manifests
├── docker-compose.yml # Docker Compose configuration
├── pom.xml # Parent POM
└── README.md # This file
Common environment variables used across services:
SPRING_PROFILES_ACTIVE=dev
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://service-discovery:8761/eureka/
SPRING_CONFIG_IMPORT=optional:configserver:http://cloud-config:9296
MANAGEMENT_ZIPKIN_TRACING_ENDPOINT=http://zipkin:9411/api/v2/spansEach service can be configured via properties files in src/main/resources/application.yml.
Run tests using Maven:
# Run all tests
./mvnw test
# Run tests with coverage
./mvnw test jacoco:reportThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with ❤️ using Spring Cloud Microservices