This project contains a collection of Spring Boot microservices that work together to provide a complete e-commerce solution with product management, inventory tracking, and order processing capabilities.
The project consists of three main microservices:
- ProductAPI - Product catalog management service (MongoDB)
- InventoryService - Inventory management service (MySQL)
- OrderService - Order processing service (MySQL)
| Service | Port | Database | Description |
|---|---|---|---|
| ProductAPI | 8080 | MongoDB (27017) | Manages product catalog and information |
| InventoryService | 8082 | MySQL (3316) | Tracks product inventory and stock levels |
| OrderService | 8083 | MySQL (3306) | Handles order creation and management |
- Java 21
- Maven 3.6+
- Docker & Docker Compose
- MongoDB
- MySQL
-
Clone the repository
git clone <repository-url> cd Project
-
Start the databases using Docker Compose
# Start MongoDB for ProductAPI cd productAPI && docker-compose up -d # Start MySQL for InventoryService cd ../InventoryService && docker-compose up -d # Start MySQL for OrderService cd ../orderService && docker-compose up -d
-
Build and run each service
# Build all services mvn clean install -f productAPI/pom.xml mvn clean install -f InventoryService/pom.xml mvn clean install -f orderService/pom.xml # Run services (in separate terminals) cd productAPI && mvn spring-boot:run cd InventoryService && mvn spring-boot:run cd orderService && mvn spring-boot:run
Each service provides Swagger UI documentation:
- ProductAPI: http://localhost:8080/swagger.html
- InventoryService: http://localhost:8082/swagger.html
- OrderService: http://localhost:8083/swagger.html
- OrderService communicates with InventoryService via OpenFeign client
- Services are designed to be loosely coupled and independently deployable
- Spring Boot 3.4.x/3.5.x
- Spring Data JPA (for MySQL services)
- Spring Data MongoDB (for ProductAPI)
- Spring Cloud OpenFeign (for inter-service communication)
- Flyway (for database migrations)
- Lombok (for reducing boilerplate code)
- SpringDoc OpenAPI (for API documentation)
- Testcontainers (for integration testing)
- Docker (for containerization)
- Uses Lombok for reducing boilerplate code
- Follows standard Spring Boot project structure
- Uses OpenAPI 3 for API documentation
- Unit tests with JUnit 5
- Integration tests with Testcontainers
- Each service has its own test suite
This project is licensed under the terms specified in the LICENSE file.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Port conflicts: Ensure ports 8080, 8082, 8083, 3306, 3316, and 27017 are available
- Database connection: Verify Docker containers are running and accessible
- Build issues: Run
mvn clean installto resolve dependency issues
# Check running Docker containers
docker ps
# View application logs
docker-compose logs
# Stop all services
docker-compose down