EcomEase is a scalable backend microservices architecture designed for an e-commerce platform. This project demonstrates the use of modern technologies to build a distributed system using microservices. The system incorporates services for managing products, orders, carts, and more, while leveraging Spring Boot, Spring Cloud, RabbitMQ, Feign Clients, and other cutting-edge technologies.
Note this is still under development, any picking up of issues would be really rejoiced 🥳
- Product Service: Manage products, categories, availability, and pricing.
- Cart Service: Handle cart creation, management, and total price calculation.
- Order Service: Place and manage orders with automatic inventory updates (bonus:
coupons
). - Config Server: Centralized configuration management using Spring Cloud Config.
- Gateway Server: API Gateway for routing and load balancing using Spring Cloud Gateway.
- Eureka Server: Service discovery and registry using Netflix Eureka.
- Message Brokers: Integration with RabbitMQ for asynchronous communication for inventory updates.
- Feign Clients: Inter-service communication using declarative REST clients.
- Database Management: SQL scripts for schema creation and seamless database integration.
- Docker Containerization: Using
docker-compose.yml
files for containerization of application.
The system is built with a modular architecture:
-
Microservices:
- Product Service: Manages product inventory and pricing.
- Cart Service: Handles cart operations and integrates with Product Service to calculate total price.
- Order Service: Processes orders and updates product inventory.
-
Infrastructure:
- Gateway Server: Acts as the single entry point for all client requests.
- Eureka Server: Enables dynamic discovery of microservices.
- Config Server: Provides centralized configuration management for all services.
-
Communication:
- Synchronous communication using Feign Clients.
- Asynchronous communication using RabbitMQ.
-
Database:
- Each microservice has its own database.
- Schema defined using SQL scripts for data consistency.
- Spring Boot
- Spring Cloud Gateway
- Spring Cloud Eureka
- Spring Cloud Config
- Feign Clients
- RabbitMQ
- Hibernate / JPA
- H2 in-memory DB
- Docker
- Keycloak
- Java 17
- Maven
- Docker
- RabbitMQ
- H2/SQL
- Keycloak
git clone https://github.com/SahilAnower/EcomEase.git
cd EcomEase
mvn clean install
Ensure you have Docker installed and running, then start the required dependencies (e.g., RabbitMQ) using Docker Compose. But first, generate images of
all microservices using mvn compile jib:dockerBuild
. Then, move over to the docker-compose directory, and start the services in any of the environments i.e, prod/qa/default using below command.
docker-compose up
For running rabbitmq in local: docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:4.0-management
. This runs the rabbitmq server
on port 5672, and the management server on port 15672.
For auth, get into the Keycloak server console, and use, Client-Credentials/AccessCode-Credentials, by creating client and registering to the required realm, assign roles such as PRODUCTS/ORDERS/CARTS
, for accessing all POST/PUT/DELETE requests inside of the application. Remember the Keycloak server by default would start on port 7080.
Navigate to each service folder and run the following:
mvn spring-boot:run
- API Gateway: http://localhost:8082
- Eureka Dashboard: http://localhost:8070
- RabbitMQ Management Console: http://localhost:15672
Configuration is managed using Spring Cloud Config. The configuration files are stored in https://github.com/SahilAnower/EcomEase-config github project.
- Product Service:
products.yml
/products-prod.yml
/products-qa.yml
Each microservice has its own database schema defined in the respective src/main/resources/schema.sql
file.
- Scaling: Enhance auto-scaling using Kubernetes.
- Monitoring: Add centralized logging and monitoring with ELK stack or Prometheus/Grafana.
Contributions are welcome! Please fork the repository and create a pull request with detailed information about your changes.
This project is licensed under the MIT License. See the LICENSE
file for details.
For any questions or support, please open an issue in the repository or contact Sahil Anower.