π Building a Production Ready Smart Course Management System with Spring Boot, MySQL & Docker

A production-style backend project built using Spring Boot, Spring Data JPA, Hibernate, MySQL, and Docker that manages Courses, Students, Instructors, and Enrollments with real-world business validations.
π GitHub Repository: https://github.com/satyajitmishra-dev/smart-course-management
π Project Overview
Managing educational courses manually becomes difficult when dealing with:
Hundreds of students
Multiple instructors
Course capacities
Enrollment tracking
Duplicate registrations
Course assignments
To solve these challenges, I built a Smart Course Management System using Spring Boot.
This project provides a complete REST API solution to manage:
β Courses
β Students
β Instructors
β Enrollments
β Soft Delete
β Business Validations
β Dockerized Deployment
ποΈ Tech Stack
| Technology | Usage |
|---|---|
| Java 25 | Programming Language |
| Spring Boot 4 | Backend Framework |
| Spring Data JPA | ORM Layer |
| Hibernate | Persistence Provider |
| MySQL | Database |
| Maven | Build Tool |
| Docker | Containerization |
| REST API | Communication |
| Lombok | Boilerplate Reduction |
π Project Structure
src
β
βββ controller
β
βββ service
β
βββ repository
β
βββ entity
β
βββ dto
β
βββ exception
β
βββ validation
β
βββ SmartCourseManagementApplication
π― Features
Course Management
Create Course
Update Course
Get Course By ID
Get All Courses
Assign Instructor
Soft Delete Course
Student Management
Create Student
Update Student
Get Student By ID
Get All Students
Soft Delete Student
Instructor Management
Create Instructor
Update Instructor
Get Instructor By ID
Get All Instructors
Soft Delete Instructor
Enrollment Management
Enroll Student
Prevent Duplicate Enrollment
Capacity Validation
Complete Enrollment
Cancel Enrollment
Enrollment Tracking
π§ Business Rules Implemented
This project is not just CRUD.
Several real-world validations have been implemented.
Duplicate Student Prevention
A student cannot register with the same email twice.
if(studentRepository.existsByEmail(email)){
throw new DuplicateResourceException();
}
Duplicate Instructor Prevention
Every instructor must have a unique email.
Course Capacity Validation
A student cannot enroll if the course capacity is already full.
Example:
Course Capacity = 50
Already Enrolled = 50
New Enrollment β Rejected
Duplicate Enrollment Prevention
A student cannot enroll in the same course twice.
Example:
Student 1 -> Spring Boot
Trying Again
Result:
409 CONFLICT
Soft Delete
Records are never physically deleted.
Instead:
active = false
This preserves historical data.
ποΈ Database Design
Student
Student
β
βββ id
βββ name
βββ email
βββ mobileNo
βββ active
βββ createdAt
βββ updatedAt
Instructor
Instructor
β
βββ id
βββ name
βββ email
βββ specialization
βββ active
βββ createdAt
Course
Course
β
βββ id
βββ title
βββ description
βββ capacity
βββ price
βββ instructor
βββ active
Enrollment
Enrollment
β
βββ id
βββ student
βββ course
βββ enrollmentDate
βββ enrollmentStatus
π Entity Relationships
Instructor
|
| One To Many
|
Course
|
| One To Many
|
Enrollment
|
| Many To One
|
Student
π REST APIs
Base URL
http://localhost:8080/api/v1
π Course APIs
Create Course
POST /courses
Request
{
"title": "Spring Boot Masterclass",
"description": "Complete Spring Boot course",
"capacity": 50,
"price": 4999
}
Get All Courses
GET /courses
Get Course By Id
GET /courses/{id}
Update Course
PUT /courses/{id}
Soft Delete Course
PATCH /courses/{id}
Assign Instructor
PATCH /courses/{courseId}/assign-instructor/{instructorId}
π¨βπ Student APIs
Create Student
POST /students
Request
{
"name": "Satyajit Mishra",
"email": "satyajit@gmail.com",
"mobileNo": "9123456789"
}
Get All Students
GET /students
Get Student By Id
GET /students/{id}
Update Student
PUT /students/{id}
Soft Delete Student
PATCH /students/{id}
π¨βπ« Instructor APIs
Create Instructor
POST /instructor
Request
{
"name": "John Smith",
"email": "john@example.com",
"specialization": "Spring Boot"
}
Get All Instructors
GET /instructor
Get Instructor By Id
GET /instructor/{id}
Update Instructor
PUT /instructor/{id}
Soft Delete Instructor
PATCH /instructor/{id}
π Enrollment APIs
Create Enrollment
POST /enrollments
Request
{
"studentId": 1,
"courseId": 1
}
Get All Enrollments
GET /enrollments
Get Enrollment By Id
GET /enrollments/{id}
Complete Enrollment
PATCH /enrollments/completed?id=1
Cancel Enrollment
PATCH /enrollments/cancel?id=1
π§ͺ Complete API Testing Flow
Step 1
Create Instructors
{
"name": "John Smith",
"email": "john@example.com",
"specialization": "Spring Boot"
}
{
"name": "Sarah Wilson",
"email": "sarah@example.com",
"specialization": "AWS"
}
Step 2
Create Courses
{
"title": "Spring Boot Masterclass",
"description": "Complete Spring Boot course",
"capacity": 50,
"price": 4999
}
{
"title": "AWS Cloud Practitioner",
"description": "AWS Fundamentals",
"capacity": 40,
"price": 5999
}
Step 3
Assign Instructors
PATCH /courses/1/assign-instructor/1
PATCH /courses/2/assign-instructor/2
Step 4
Create Students
{
"name": "Satyajit Mishra",
"email": "satyajit@gmail.com",
"mobileNo": "9123456789"
}
{
"name": "Ananya Sharma",
"email": "ananya@gmail.com",
"mobileNo": "9876543210"
}
Step 5
Enroll Students
{
"studentId": 1,
"courseId": 1
}
{
"studentId": 2,
"courseId": 2
}
Step 6
Verify Data
GET /courses
GET /students
GET /instructor
GET /enrollments
Step 7
Complete Enrollment
PATCH /enrollments/completed?id=1
Step 8
Cancel Enrollment
PATCH /enrollments/cancel?id=2
β Failure Scenarios Covered
| Scenario | Status |
|---|---|
| Duplicate Student Email | 409 Conflict |
| Duplicate Instructor Email | 409 Conflict |
| Student Already Enrolled | 409 Conflict |
| Course Capacity Full | 409 Conflict |
| Invalid Student ID | 404 Not Found |
| Invalid Course ID | 404 Not Found |
| Invalid Instructor ID | 404 Not Found |
| Deleted Student Access | 404 Not Found |
| Deleted Course Access | 404 Not Found |
| Deleted Instructor Access | 404 Not Found |
π³ Docker Support
The application can run completely inside Docker containers.
Docker Compose
services:
mysql:
image: mysql:8.0
container_name: mysql-db
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: smart_course_management
ports:
- "3307:3306"
app:
build: .
container_name: smart-course-app
depends_on:
- mysql
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/smart_course_management
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root123
Run:
docker compose up --build
π Future Improvements
Planned features:
JWT Authentication
Role Based Access Control
Course Categories
Course Reviews & Ratings
Payment Integration
Email Notifications
Pagination & Sorting
Search APIs
Swagger Documentation
CI/CD Pipeline
AWS Deployment
Redis Caching
Docker Multi-stage Build
Kubernetes Deployment
π What I Learned
While building this project I gained hands-on experience with:
Spring Boot Architecture
Layered Design Pattern
JPA Relationships
Hibernate
Exception Handling
DTO Mapping
Validation
Business Rules Implementation
Docker Containerization
REST API Design
MySQL Integration
π Project Repository
GitHub:
https://github.com/satyajitmishra-dev/smart-course-management
π¬ Final Thoughts
This project helped me move beyond basic CRUD operations and understand how real-world backend systems are designed.
By implementing business validations, entity relationships, enrollment workflows, soft deletion, and Docker deployment, I gained practical experience that closely resembles production-grade application development.
If you're learning Spring Boot and want a project that covers CRUD, JPA, Hibernate, MySQL, REST APIs, validation, and Docker in one place, this project is a great reference.
β If you found this project useful, consider giving it a star on GitHub.



