A robust, scalable Microservices-based E-Learning Platform built with Spring Boot and Spring Cloud. The system features a decentralized architecture where services like User Management, Course Catalog, Enrollment, and Billing operate independently but communicate seamlessly via REST APIs (Feign Clients) and Asynchronous Messaging (RabbitMQ). Key engineering highlights include Service Discovery (Eureka), Centralized Configuration, API Gateway routing, and Fault Tolerance using Resilience4j Circuit Breakers to ensure high availability even during partial system failures.
- Microservices Architecture: Decoupled services for Users, Courses, Enrollments, Billing, and Notifications.
- Service Discovery: Dynamic scaling and lookup using Netflix Eureka Server.
- API Gateway: Centralized entry point with Spring Cloud Gateway for routing and load balancing.
- Inter-Service Communication: Synchronous via OpenFeign and asynchronous via RabbitMQ.
- Fault Tolerance: Implemented Resilience4j Circuit Breaker for graceful degradation during service outages.
- Centralized Configuration: Managed external properties across environments using Spring Cloud Config Server.
- Event-Driven Notifications: Asynchronous processing of user activities to trigger notifications.
- Database per Service: Isolated data persistence using H2/JPA for domain boundaries.
- Distributed Tracing: Architecture supports observability patterns for monitoring request flows.
- Scalable Design: Stateless services designed for horizontal scaling in cloud environments.
The platform follows a classic microservices pattern. Requests enter through the API Gateway, which routes them to the appropriate service. Services register themselves with the Discovery Server.
graph TD
Client[Client App / Browser] --> Gateway[API Gateway :8080]
subgraph Infrastructure
Config[Config Server :8888]
Eureka[Discovery Server :8761]
end
subgraph Core Services
User[User Service]
Course[Course Service]
Enrollment[Enrollment Service]
Billing[Billing Service]
Activity[Activity Service]
end
subgraph Async Processing
MQ((RabbitMQ))
Notif[Notification Service]
end
Gateway --> User
Gateway --> Course
Gateway --> Enrollment
Gateway --> Billing
Gateway --> Activity
Enrollment -- Feign Client --> Course
Activity -- Async Event --> MQ
MQ --> Notif
User -.-> Eureka
Course -.-> Eureka
Enrollment -.-> Eureka
Billing -.-> Eureka
Activity -.-> Eureka
Gateway -.-> Eureka
| Service Name | Port | Description | Key Tech |
|---|---|---|---|
| Config Server | 8888 | Centralized configuration management for all microservices. | Spring Cloud Config |
| Discovery Server | 8761 | Service registry (Eureka) for dynamic service discovery. | Netflix Eureka |
| API Gateway | 8080 | Single entry point, routing, and load balancing. | Spring Cloud Gateway |
| User Service | Random | Manages user registration, authentication, and profiles. | Spring Data JPA, H2 |
| Course Service | Random | Manages course creation, details, and catalog. | Spring Web, Lombok |
| Enrollment Service | Random | Handles course enrollments with fault tolerance. | OpenFeign, Resilience4j |
| Activity Service | Random | Logs user actions and publishes events. | RabbitMQ Producer |
| Notification Service | Random | Consumes events to send emails/SMS. | RabbitMQ Consumer |
This flow demonstrates the Circuit Breaker pattern. When a user attempts to enroll, the Enrollment Service must verify the course exists by calling the Course Service.
- Request:
POST /api/enrollmentshits API Gateway -> Enrollment Service. - Verification: Enrollment Service uses
CourseClient(Feign) to call Course Service. - Success Path: Course exists -> Enrollment saved as
ACTIVE. - Failure Path (Resilience): If Course Service is down,
Resilience4jtriggers theenrollFallbackmethod. The enrollment is saved asPENDING_VERIFICATIONinstead of failing the request, ensuring a good user experience.
This flow demonstrates Event-Driven Architecture for decoupling high-throughput actions from side effects like notifications.
- Action: User completes a lesson. Client sends
POST /api/activities. - Publish: Activity Service saves the log and sends a message to the
activityQueuein RabbitMQ. - Acknowledge: Activity Service responds immediately to the user (low latency).
- Process: Notification Service (listening on
activityQueue) picks up the message asynchronously. - Notify: Notification Service triggers the email/SMS logic.
- Language: Java 17
- Framework: Spring Boot 3.2.3
- Cloud Native: Spring Cloud 2023.0.0 (Gateway, Config, Netflix Eureka, OpenFeign)
- Resilience: Resilience4j (Circuit Breaker)
- Messaging: RabbitMQ (AMQP)
- Database: H2 (In-memory for dev/test), Spring Data JPA
- Build Tool: Maven