A simple, modular, and well-structured RESTful API built with Spring Boot, designed to manage student records. This project demonstrates core backend concepts like layered architecture, dependency injection, REST API development, and database interaction using Spring Data JPA.
- 📦 CRUD operations for student entities
- 🧠 Follows a layered architecture: Controller → Service → Repository
- 🔌 Uses Spring Data JPA for data persistence
- 🛠 Pre-loads sample student data on startup via
StudentConfig.java - 📂 Clean code separation and standard naming conventions
- ⚙️ Easily configurable with
application.properties - 🧪 Ready for extension with test cases under
/test/java/...
- Java 17+
- Spring Boot
- Spring Web
- Spring Data JPA
- H2 / MySQL (configurable via
application.properties) - Maven
springboot-student-api/ ├── src/ │ ├── main/ │ │ ├── java/com/example/demo/ │ │ │ ├── DemoApplication.java │ │ │ └── student/ │ │ │ ├── Student.java │ │ │ ├── StudentConfig.java │ │ │ ├── StudentController.java │ │ │ ├── StudentService.java │ │ │ └── StudentRepository.java │ │ └── resources/ │ │ └── application.properties │ └── test/java/com/example/demo/ │ └── Test files ├── pom.xml
- GET
/api/v1/student→ Get all students - POST
/api/v1/student→ Add a new student - DELETE
/api/v1/student/{id}→ Delete student by ID - PUT
/api/v1/student/{id}→ Update student by ID
You can customize or extend these routes inside
StudentController.java.
- Java 17+
- Maven
git clone https://github.com/The6ixDev/springboot-student-api.git cd springboot-student-api
./mvnw spring-boot:run
By default, the app runs on http://localhost:8080.
POST /api/v1/student
Content-Type: application/json
{ "name": "John Doe", "email": "john.doe@example.com", "dob": "2000-06-15" }
You can configure DB details (e.g., use H2 or MySQL) in:
src/main/resources/application.properties
Example for MySQL:
spring.datasource.url=jdbc:mysql://localhost:3306/studentdb
spring.datasource.username=root
spring.datasource.password=yourpassword
spring.jpa.hibernate.ddl-auto=update
This project helped reinforce:
- Setting up Spring Boot applications with Maven
- Defining REST controllers and services
- Dependency injection and service separation
- Using Spring Data JPA with repository interfaces
- Creating domain models and managing entity relationships
- Seeding databases with config classes
This project is open-source and free to use.
Hamid
GitHub: https://github.com/The6ixDev