Skip to content

andrecastrosousa/ecommerce-microservice

Repository files navigation

Ecommerce Microservice Project

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.

Table of Contents

Introduction

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.

Services

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.

Technologies Used

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.

Getting Started

To get started with the project, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/andrecastrosousa/ecommerce-microservice
  2. Navigate to the project directory:

    cd ecommerce-microservice
  3. Start the services, ensuring that dependencies like MongoDB, PostgreSQL, MySQL, RabbitMQ and Redis are up.

    using the following command:

    docker-compose up -d
    
  4. Explore and interact with the services as needed for your ecommerce application.

Run Single Service

  1. Clone the repository to your local machine:

    git clone https://github.com/andrecastrosousa/ecommerce-microservice
  2. Navigate to the project directory:

    cd ecommerce-microservice
  3. Navigate to the service directory e.g order-service:

    cd order-service
    
  4. Start the service, ensuring that dependencies e.g order-service it will be PostgreSQL is up.

    using the following command:

    docker-compose up -d
    
  5. Explore and interact with the services as needed for your ecommerce application.

Dockerization

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.

Testing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages