Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Spring Boot Student API

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.


🚀 Features

  • 📦 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/...

🧰 Tech Stack

  • Java 17+
  • Spring Boot
  • Spring Web
  • Spring Data JPA
  • H2 / MySQL (configurable via application.properties)
  • Maven

📁 Project Structure

 
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
 

📬 Sample API Endpoints

  • 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.


⚙️ Getting Started

✅ Prerequisites

  • Java 17+
  • Maven

▶️ To Run the App

Clone the project

git clone https://github.com/The6ixDev/springboot-student-api.git cd springboot-student-api

Build and run

./mvnw spring-boot:run

By default, the app runs on http://localhost:8080.


🧪 Example Request (POST)

POST /api/v1/student
Content-Type: application/json

{ "name": "John Doe", "email": "john.doe@example.com", "dob": "2000-06-15" }


🛠 Configuration (application.properties)

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


🧠 What I Learned

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

📜 License

This project is open-source and free to use.


🙋‍♂️ Author

Hamid
GitHub: https://github.com/The6ixDev

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages