This project is a backend implementation of an E-commerce application, transitioning from a monolithic architecture to a microservices architecture. The system is composed of several independent services for handling customers, products, orders, payments, and notifications, each managed as its own microservice.
- Java 21: Base programming language for all services
- Spring Boot 3: For building REST APIs and handling service logic
- PostgreSQL: Database for product, order, and payment services
- MongoDB: Database for customer and notification services
- Apache Kafka: Asynchronous message streaming for communication between services
- Docker: Containerization for service deployment
- Eureka Discovery Server: Service registry for service discovery
- Config Server: Centralized configuration management for microservices
- Zipkin: Distributed tracing for monitoring and logging
- Customer Service: Manages customer information and profiles.
- Product Service: Manages product catalog, pricing, and availability.
- Order Service: Handles order creation, management, and tracking.
- Payment Service: Processes payments for customer orders.
- Notification Service: Sends email notifications to users after orders are confirmed and payments are processed.
- Config Server: Provides external configuration to all services.
- Eureka Discovery Server: Registers and discovers services dynamically.
- Microservices Architecture: Services are decoupled, independently deployable, and can scale horizontally.
- Asynchronous Communication: Apache Kafka enables efficient communication between services.
- Email Notifications: Automated email notifications sent to users upon successful order confirmation and payment.
- Distributed Tracing: Zipkin provides end-to-end visibility for requests across services, aiding in debugging and performance monitoring.
- Java 21 installed
- Docker installed for containerization
- PostgreSQL and MongoDB set up locally or via Docker
- Kafka and Zookeeper for messaging (can be set up via Docker)
-
Clone the repository:
git clone https://github.com/yourusername/ecommerce-microservices-backend.git cd ecommerce-microservices-backend
-
Start all services using Docker Compose:
docker-compose up
-
Once services are running, access them via their respective API endpoints.
-
Eureka Discovery Server can be accessed at:
http://localhost:8761/
-
Use Postman or any API client to test the REST APIs of each service.
-
PostgreSQL: Used for Product, Order, and Payment services. Ensure you set the correct connection settings in the respective service's
application.properties
. -
MongoDB: Used for Customer and Notification services. Ensure MongoDB is running and accessible.
Ensure that Kafka and Zookeeper are up and running (via Docker or locally) to handle asynchronous messaging.
-
Zipkin is used for logging and tracing service interactions. Access the Zipkin dashboard at:
http://localhost:9411/
All services are containerized using Docker for consistent deployment. Simply run:
docker-compose up
to spin up all services along with their dependencies (PostgreSQL, MongoDB, Kafka, etc.).
- Add more robust error handling and fault tolerance across services.
- Implement OAuth2 for authentication and authorization.
- Introduce load balancing using Spring Cloud Gateway.
- Add more features to notification service (e.g., SMS notifications).
Feel free to submit issues, fork the repo, and submit pull requests! Contributions are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.