A complete e-commerce application based on microservices architecture, composed of three independent services: User API, Product API, and Shopping API.
This project implements an e-commerce system using a microservices architecture, where each component operates independently and communicates through REST APIs. The application follows Clean Architecture and Domain-Driven Design principles and is containerized with Docker for easy deployment and environment management.
The system consists of three main microservices:
- User management (registration, updates, queries)
- Personal data and address storage
- Authentication and authorization
- Product registration and management
- Categorization
- Inventory control
- Advanced search with pagination and HATEOAS support
- Shopping cart
- Order processing
- Sales reports
- User purchase history
- Integration with other microservices
Each service has its own database and can be deployed and scaled independently.
- Java 17
- Spring Boot
- Spring Data JPA
- PostgreSQL for data persistence
- Spring WebFlux for asynchronous communication between microservices
- Docker & Docker Compose for containerization
- Flyway for database migrations
- Swagger for API documentation
- JUnit 5 & Mockito for unit and integration testing
- WireMock for service integration testing
- Docker installed: Docker Installation Guide
- Docker Compose installed: Docker Compose Installation Guide
- Python 3.11+ (recommended for running automation scripts)
- Java 17+ and Maven (for development)
This method is ideal for Linux environments and offers a simplified experience:
-
To start all services:
python deploy.py
-
To shut down all containers:
python down.py
If you prefer not to use Python scripts or are on a different operating system:
-
Create a Docker network for the microservices:
docker network create ecommerce
-
Start each service individually:
# In the project root docker compose up -d # Or navigate to each directory and run cd user-api docker compose up -d cd ../product-api docker compose up -d cd ../shopping-api docker compose up -d
- RESTful Design with DTOs and object-relational mapping
- Robust Validation of input data
- Global Exception Handling with standardized error messages
- Pagination and Sorting for resource lists
- Resilient Communication between microservices
- Sales Reports with custom filters
- Comprehensive Testing unit and integration (90%+ coverage)
All services have Swagger documentation available:
http://localhost:8080/api/v1/swagger-ui/index.html
http://localhost:8081/api/v1/swagger-ui/index.html
http://localhost:8082/api/v1/swagger-ui/index.html
The project includes an extensive test suite:
- Unit Tests for all service classes and controllers
- Integration Tests to validate communication between microservices
- Repository Tests to ensure correct data persistence
- Mocks and Stubs to isolate components during testing
Each microservice uses its own PostgreSQL database. Migrations are managed automatically during startup using Flyway.
Developed with ❤️ as a microservices architecture demonstration project.