This project is a microservices-based online learning platform. It consists of five main services: api-gateway, user-service, course-service, enrollment-service and a course-server which acts as a Eureka server for service discovery.
- Port: 8080
- Description: The single entry point for all client requests. It routes requests to the appropriate microservice and handles cross-cutting concerns like authentication and logging.
- Port: 8081
- Description: Manages user registration, login, and authentication. It uses JWT for secure communication.
- Database: MySQL
- API Endpoints:
POST /api/v1/auth/register: Register a new user.POST /api/v1/auth/login: Authenticate a user and receive a JWT token.
- Port: 8082
- Description: Manages course-related operations, including creating, retrieving, updating, and deleting courses.
- Database: MySQL
- API Endpoints:
POST /api/v1/courses: Create a new course.GET /api/v1/courses/{id}: Retrieve a course by ID.GET /api/v1/courses: Retrieve all courses.PUT /api/v1/courses/{id}: Update an existing course.DELETE /api/v1/courses/{id}: Delete a course by ID.
- Port: 8083
- Description: Manages student enrollment in courses.
- Database: MySQL
- API Endpoints:
POST /api/v1/enrollments: Enroll a student in a course.GET /api/v1/enrollments/student/{studentId}: Retrieve all enrollments for a student.
- Port: 8761
- Description: A Spring Cloud Netflix Eureka server that provides service discovery for the microservices in the platform.
- Java 21
- Maven
- Docker
- MySQL
- Clone the repository:
git clone https://github.com/Femi-P/online-learning-platform-microservice.git
- Build the project:
mvn clean install -DskipTests
- Run the application:
docker-compose up -d
-
Start the Course Server (Eureka):
- Navigate to the
course-serverdirectory. - Run the application using
mvn spring-boot:run.
- Navigate to the
-
Start the User Service:
- Navigate to the
user-servicedirectory. - Make sure your MySQL server is running and the database
userdbis created. - Update the
application.ymlfile with your MySQL username and password. - Run the application using
mvn spring-boot:run.
- Navigate to the
-
Start the Course Service:
- Navigate to the
course-servicedirectory. - Make sure your MySQL server is running and the database
coursedbis created. - Update the
application.ymlfile with your MySQL username and password. - Run the application using
mvn spring-boot:run.
- Navigate to the
-
Start the Enrollment Service:
- Navigate to the
enrollment-servicedirectory. - Make sure your MySQL server is running and the database
enrollment_dbis created. - Update the
application.ymlfile with your MySQL username and password. - Run the application using
mvn spring-boot:run.
- Navigate to the
-
Start the API Gateway:
- Navigate to the
api-gatewaydirectory. - Run the application using
mvn spring-boot:run.
- Navigate to the
You can use the included http-request files to test the API endpoints using an appropriate REST client.
http-request/auth.http: User authentication endpoints.http-request/course.http: Course management endpoints.http-request/enrollment.http: Enrollment management endpoints.http-request/gateway.http: API gateway endpoints.