https://github.com/sverrenystad/e-commerce-microservices
An E-Commerce platform using microservice architecture
https://github.com/sverrenystad/e-commerce-microservices
docker-compose eureka-service-discovery hibernate java kafka keycloak load-balancer microservices mongodb monorepo openfeign pgadmin4 postgresql resttemplate slf4j springboot zipkin
Last synced: 7 months ago
JSON representation
An E-Commerce platform using microservice architecture
- Host: GitHub
- URL: https://github.com/sverrenystad/e-commerce-microservices
- Owner: SverreNystad
- License: mit
- Created: 2025-05-23T21:41:21.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-05-31T21:39:24.000Z (9 months ago)
- Last Synced: 2025-07-19T12:37:47.674Z (7 months ago)
- Topics: docker-compose, eureka-service-discovery, hibernate, java, kafka, keycloak, load-balancer, microservices, mongodb, monorepo, openfeign, pgadmin4, postgresql, resttemplate, slf4j, springboot, zipkin
- Language: Java
- Homepage:
- Size: 156 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# E-Commerce application
The goal of this application was to try to create a microservice architecture for a simple e-commerce application. The application is built using a monorepo structure, which allows for easier management of multiple services and shared code.
## Architecture Overview
The application is structured into several microservices, each responsible for a specific domain within the e-commerce ecosystem. The services include:
- **Product Service**: Manages product information, including details, pricing, and availability.
- **Order Service**: Handles customer orders, including order creation, updates, and status tracking.
- **Customer Service**: Manages customer information, including registration and profile management.
- **Payment Service**: Processes payments for orders, integrating with external payment gateways.
- **Notification Service**: Sends notifications to customers via email for order confirmations.
### Technologies Used
This project utilizes a variety of technologies to create a robust microservices architecture. Below is a breakdown of the key components used in this application.
**Core**
* **Language & Framework:** Java 21, Spring Boot
* **Service Mesh:** Spring Cloud Netflix Eureka (discovery), Spring Cloud Gateway (API gateway)
* **Configuration Management:** Spring Cloud Config Server, to manage application properties across services
* **Security:** Keycloak for authentication and authorization
* **API Documentation:** OpenAPI (Swagger) for API documentation
* **Build Tool:** Gradle <3 for dependency management and build automation
**Datastores**
I used Hibernate for ORM with JPA, and both PostgreSQL and MongoDB as data stores.
* **Relational:** PostgreSQL (With and without Flyway migrations)
* **No-SQL:** MongoDB
**Messaging & Integration**
Note here that both OpenFeign and RestTemplate are used for REST communication. This was to test different approaches to synchronous service communication.
* **Apache Kafka**: For asynchronous communication between services
* **OpenFeign**: For REST client communication between services
* **RestTemplate**: For synchronous REST calls between services
**Infrastructure & Deployment**
All services are containerized using Docker, and Docker Compose is used to orchestrate the services. The infrastructure is managed using Terraform for Infrastructure as Code (IaC) specifically for Azure. The application is a monorepo.
**Monitoring & Logging**
* **Zipkin**: For distributed tracing
* **Slf4j**: For logging, with Logback as the logging implementation
**Management Tools**
* **pgAdmin**: To manage PostgreSQL databases
* **MongoDB Express**: To manage MongoDB databases
## Prerequisites
- Ensure that git is installed on your machine. [Download Git](https://git-scm.com/downloads)
- Docker is used for the backend and database setup. [Download Docker](https://www.docker.com/products/docker-desktop)
## Usage
To run the application, you can use Docker Compose to start all the services.
```bash
docker compose up --build -d
```
## Testing
Each service has its own set of unit and integration tests. You can run the tests using Gradle:
```bash
./gradlew test
```
## Documentation
- [Developer Setup](docs/manuals/developer-setup.md)
- [Terraform (IaC)](docs/manuals/infrastructure_as_code.md)
## Acknowledgements
I would like to thank **Bouali Ali** for his excellent course on microservices with Spring Boot and Docker, which served as a foundation for this project. You can find the course [here](https://www.youtube.com/watch?v=jdeSV0GRvwI&t)