A RESTful Student Management API built with Java and Spring Boot. The project demonstrates backend development concepts including REST APIs, CRUD operations, Spring Data JPA, Hibernate, MySQL, validation, and entity relationships.
- Student management with CRUD operations
- Course management
- Student-course enrollment management
- RESTful API endpoints
- MySQL database integration
- Spring Data JPA and Hibernate
- Jakarta Bean Validation
- Entity relationships with JPA
- OpenAPI / Swagger API documentation
- Spring Boot Actuator
| Technology | Purpose |
|---|---|
| Java 26 | Programming language |
| Spring Boot 4.1.1 | Application framework |
| Spring MVC | REST API development |
| Spring Data JPA | Data access |
| Hibernate | ORM |
| MySQL | Relational database |
| Jakarta Validation | Request validation |
| Maven | Build & dependency management |
| Springdoc OpenAPI | API documentation |
| Spring Boot Actuator | Application monitoring |
The API manages three main resources:
Stores student information such as:
- ID
- First name
- Last name
- Date of birth
- Phone number
Stores information about available courses, including a generated course code.
Represents the relationship between a student and a course.
It contains information such as:
- Student
- Course
- Enrollment date
- Grade
The StudentCourse resource demonstrates a JPA relationship between students and courses.
The API uses the /api base path.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/students |
Get all students |
| GET | /api/students/{id} |
Get a student by ID |
| POST | /api/students |
Create a student |
| PUT | /api/students/{id} |
Update a student |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/courses |
Get all courses |
| GET | /api/courses/{id} |
Get a course by ID |
| POST | /api/courses |
Create a course |
| PUT | /api/courses/{id} |
Update a course |
| DELETE | /api/courses/{id} |
Delete a course |
The StudentCourse resource connects students with courses and stores enrollment information and grades.
Example relationship:
Student
β
β 1
β
ββββββββββββ*
β
StudentCourse
β
β *
β
ββββββββββββ1
Course
The API uses Jakarta Bean Validation to validate incoming request data.
For example:
@Valid
@RequestBody Student studentValidation annotations can then be applied to fields to ensure that invalid data is rejected before it reaches the business logic.
The application uses MySQL as its relational database.
JPA and Hibernate handle the mapping between Java objects and database tables.
The main database relationships include:
students
β
β
βββ student_courses ββ courses
This allows a student to be associated with courses through the student_courses table.
The project uses Springdoc OpenAPI to generate API documentation and a Swagger UI interface.
After starting the application, Swagger UI can be accessed through the configured Springdoc endpoint.
git clone https://github.com/BeatrixBlaine/Student-Management-RestAPI.git
cd Student-Management-RestAPICreate a MySQL database for the application.
Then configure the database connection in:
src/main/resources/application.properties
Example:
spring.datasource.url=jdbc:mysql://localhost:3306/student_management
spring.datasource.username=your_username
spring.datasource.password=your_passwordUse your own MySQL username and password.
Using the Maven wrapper:
Windows
mvnw.cmd spring-boot:runmacOS / Linux
./mvnw spring-boot:runOr run the main Spring Boot application directly from your IDE.
The API will then be available at:
http://localhost:8080
POST /api/students
Content-Type: application/jsonExample request body:
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"dateOfBirth": "2000-01-15",
"phone": "081234567890"
}GET /api/studentsThe application follows a layered Spring Boot architecture:
Controller
β
Service
β
Repository
β
JPA / Hibernate
β
MySQL
Handles HTTP requests and exposes REST endpoints.
Contains application/business logic.
Handles database operations through Spring Data JPA.
Represents database tables and their relationships.
Used when request or response data needs to be separated from the database entity model.
This project was built to practice and strengthen backend development skills with Java and Spring Boot, including:
- Building REST APIs
- HTTP methods and REST conventions
- CRUD operations
- Spring MVC
- Dependency injection
- Spring Data JPA
- Hibernate
- MySQL
- JPA entity relationships
- DTOs
- Jakarta Bean Validation
- OpenAPI / Swagger
- Maven
- Debugging REST APIs
Possible future improvements include:
- Global exception handling
- More comprehensive DTO mapping
- Pagination
- Sorting and filtering
- Automated unit and integration tests
- Improved API documentation
- Improved error response structure
Beatrix Blaine
GitHub: https://github.com/BeatrixBlaine
This project is part of my ongoing Java and Spring Boot backend development practice.