Welcome to the "Ecommerce Microservice" project, a REST API implementation using the microservices architecture for an ecommerce platform built with Spring Boot. This project leverages various technologies and databases, including Keycloak for authentication, MongoDB for the catalog service using reactive Spring WebFlux, PostgreSQL for the order service, and MySQL for the shipping service. The goal of this project is to learn how to build a fully-fledged microservices-based REST API while exploring different database technologies, event-driven communication using RabbitMQ, service discovery with Eureka, and containerization with Docker.
The "Ecommerce Microservice" project is an example of a microservices-based architecture for an ecommerce platform. It is designed to demonstrate best practices in building scalable and maintainable microservices using Spring Boot.
This project comprises several microservices:
- Authentication Service (Redis): Provides authentication and authorization for users.
- Catalog Service (MongoDB with Reactive Spring WebFlux): Manages product catalog data with a NoSQL database and leverages the reactive programming model.
- Order Service (PostgreSQL): Handles order processing and management using a SQL database.
- User Service (MySQL): Manages user information.
- Event-Driven Communication (RabbitMQ): Implements event-driven architecture to enable communication and data synchronization between microservices.
- Service Discovery (Eureka): Offers service registration and discovery capabilities for seamless communication between microservices.
- API Gateway: Serves as an entry point to the microservices architecture, routing and managing incoming HTTP requests to the appropriate microservices.
The project utilizes the following technologies:
- Spring Boot: For building microservices.
- Redis: For authentication and authorization.
- MongoDB: For the catalog service with reactive Spring WebFlux.
- PostgreSQL: For the order service.
- MySQL: For the shipping service.
- RabbitMQ: For event-driven communication.
- Eureka: For service discovery.
- API Gateway: For routing and managing incoming HTTP requests to the appropriate microservices.
- Docker: For containerization and managing dependencies.
- Github Actions: For pipeline to try to build domain services.
To get started with the project, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/andrecastrosousa/ecommerce-microservice
-
Navigate to the project directory:
cd ecommerce-microservice
-
Start the services, ensuring that dependencies like MongoDB, PostgreSQL, MySQL, RabbitMQ and Redis are up.
using the following command:
docker-compose up -d
-
Explore and interact with the services as needed for your ecommerce application.
-
Clone the repository to your local machine:
git clone https://github.com/andrecastrosousa/ecommerce-microservice
-
Navigate to the project directory:
cd ecommerce-microservice
-
Navigate to the service directory e.g order-service:
cd order-service
-
Start the service, ensuring that dependencies e.g order-service it will be PostgreSQL is up.
using the following command:
docker-compose up -d
-
Explore and interact with the services as needed for your ecommerce application.
This project leverages Docker to manage software dependencies. You can use the provided Docker Compose file to build and run containers for the required services, including databases, RabbitMQ, Eureka, Keycloak, MongoDB, and PostgreSQL. Refer to the project's Docker documentation for detailed instructions.
The project includes unit and integration tests for each microservice to demonstrate best practices in testing microservices. You can run these tests to ensure the correctness and reliability of your microservices.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to reach out to the author with any questions or feedback related to the project.
Thank you for exploring the "Ecommerce Microservice" project, and I hope it helps you understand and implement microservices architecture for your own projects.