This project implements a comprehensive Learning Management System (LMS) using a microservices architecture with Spring Boot 3, WebFlux, PostgreSQL, Redis, RabbitMQ, and Kubernetes deployment.
- User Service (Port: 8081) - User management, authentication, profiles
- Course Service (Port: 8082) - Course content, modules, lessons
- Enrollment Service (Port: 8083) - Student enrollments, progress tracking
- Assessment Service (Port: 8084) - Quizzes, assignments, grading
- Notification Service (Port: 8085) - Email, push notifications
- API Gateway (Port: 8080) - Spring Cloud Gateway for routing
- Config Server (Port: 8888) - Centralized configuration
- Discovery Server (Port: 8761) - Eureka service registry
- Framework: Spring Boot 3.2.0
- Reactive: Spring WebFlux
- Database: PostgreSQL with R2DBC
- Caching: Redis
- Message Broker: RabbitMQ
- Service Discovery: Eureka
- API Gateway: Spring Cloud Gateway
- Security: JWT + OAuth2
- Containerization: Docker
- Orchestration: Kubernetes
- Monitoring: Prometheus + Grafana
Each service has its own PostgreSQL database following the database-per-service pattern:
- users (id, username, email, password_hash, first_name, last_name, role, status)
- user_profiles (id, user_id, bio, avatar_url, phone, preferences)- courses (id, title, description, instructor_id, category_id, level, price)
- course_modules (id, course_id, title, description, order_index)
- lessons (id, module_id, title, content, video_url, duration_minutes)
- course_categories (id, name, description, parent_id)- enrollments (id, student_id, course_id, enrollment_date, progress_percentage)
- lesson_progress (id, enrollment_id, lesson_id, completed_at, time_spent)
- learning_paths (id, name, description, created_by)- assessments (id, course_id, title, type, max_score, time_limit)
- assessment_questions (id, assessment_id, question_text, question_type, points)
- assessment_submissions (id, assessment_id, student_id, score, status)- notifications (id, recipient_id, type, message, status, sent_at)
- notification_templates (id, name, type, subject, body, variables)
- notification_preferences (id, user_id, email_enabled, push_enabled)POST /- Create userGET /{id}- Get user by IDPUT /{id}- Update userDELETE /{id}- Delete userGET /search- Search usersPATCH /{id}/status- Update user status
GET /- List coursesPOST /- Create courseGET /{id}- Get course detailsGET /{id}/modules- Get course modulesPOST /{id}/modules- Add course module
POST /- Enroll studentGET /student/{id}- Get student enrollmentsPUT /{id}/progress- Update progressGET /analytics/{courseId}- Get enrollment analytics
GET /course/{courseId}- Get course assessmentsPOST /- Create assessmentPOST /{id}/submit- Submit assessmentGET /submissions/student/{id}- Get student submissions
POST /send- Send notificationGET /user/{userId}- Get user notificationsPUT /{id}/read- Mark as readPOST /bulk-send- Send bulk notifications
- User Events:
user.created,user.updated,user.deleted,user.status.changed - Course Events:
course.created,course.published,course.updated - Enrollment Events:
enrollment.created,enrollment.completed,progress.updated - Assessment Events:
assessment.submitted,assessment.graded
User Registration β user.created β notification-service (welcome email)
Course Published β course.published β notification-service (notify enrolled students)
Assessment Submitted β assessment.submitted β notification-service (notify instructor)
- User authenticates via API Gateway
- JWT token issued with user claims and roles
- Each service validates JWT independently
- Role-based access control (RBAC) enforced
- STUDENT: View courses, enroll, submit assessments, track progress
- INSTRUCTOR: Create courses, grade assessments, view student progress
- ADMIN: Full system access, user management, analytics
- Java 17+
- Docker & Docker Compose
- Maven 3.8+
- Kubernetes (optional, for production deployment)
# Clone the repository
git clone <repository-url>
cd lms-services
# Start infrastructure services
docker-compose up -d postgres-users postgres-courses postgres-enrollments postgres-assessments postgres-notifications redis rabbitmq
# Start discovery server
cd discovery-service && mvn spring-boot:run
# Start config server
cd config-service && mvn spring-boot:run
# Start individual services
cd user-service && mvn spring-boot:run
cd course-service && mvn spring-boot:run
cd enrollment-service && mvn spring-boot:run
cd assessment-service && mvn spring-boot:run
cd notification-service && mvn spring-boot:run
# Start API Gateway
cd gateway-service && mvn spring-boot:run# Build and start all services
docker-compose up --build
# View logs
docker-compose logs -f user-service
# Scale services
docker-compose up --scale user-service=3# Apply database configurations
kubectl apply -f kubernetes/postgres/
# Apply infrastructure services
kubectl apply -f kubernetes/infrastructure/
# Apply business services
kubectl apply -f kubernetes/services/
# Check deployment status
kubectl get pods -l app=user-serviceAll services expose health endpoints at /actuator/health
- Prometheus: Metrics collection (port 9090)
- Grafana: Visualization dashboards (port 3000)
- Custom Metrics: Business metrics for each service
- Spring Cloud Sleuth: Request tracing
- Jaeger: Trace visualization
- Correlation IDs: End-to-end request tracking
- Structured JSON logging
- Centralized log aggregation
- Request/response logging with correlation IDs
# Run unit tests for all services
mvn test
# Generate coverage report
mvn jacoco:report# Run integration tests with testcontainers
mvn verify -P integration-tests- Consumer-driven contract testing with Pact
- API contract validation
- Cross-service communication testing
- User Sessions: Redis-based session storage
- Course Catalog: Cached with TTL
- Assessment Results: Cached for quick retrieval
- Cache Invalidation: Event-driven cache updates
- Connection pooling with HikariCP
- Read replicas for read-heavy operations
- Database indexes for performance
- Partitioning for large tables
- Stateless service design
- Load balancing with Spring Cloud Gateway
- Auto-scaling with Kubernetes HPA
- Circuit breaker pattern for resilience
stages:
- test
- build
- deploy
test:
script:
- mvn test
- mvn verify -P integration-tests
build:
script:
- docker build -t lms/user-service .
- docker push lms/user-service
deploy:
script:
- kubectl apply -f kubernetes/- Separate configurations for dev/staging/prod
- Secret management with Kubernetes secrets
- Environment-specific database configurations
- TLS/SSL encryption
- Network policies
- Vulnerability scanning
- Security headers
- Automated database backups
- Point-in-time recovery
- Disaster recovery procedures
- Data retention policies
Interactive API documentation is available via Swagger UI:
- User Service: http://localhost:8081/swagger-ui.html
- Course Service: http://localhost:8082/swagger-ui.html
- Assessment Service: http://localhost:8084/swagger-ui.html
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Contact the development team
- Check the documentation wiki
Happy Learning! π