Skip to content

A Spring Boot REST API for academic management — manage students, subjects, departments, enrollments, ID cards, and user logins using a clean DTO-based architecture, PostgreSQL, and standardized JSON responses with ResponseBean. Built without service layers for simplicity and direct repository-controller interaction.

License

Notifications You must be signed in to change notification settings

kracgan/student-management-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Student Management System - Backend API

A modern Spring Boot REST API for managing students, subjects, departments, and enrollments using a DTO-driven architecture and clean controller-repository pattern.


🚀 Features

  • Manage Students, Departments, Subjects, ID Cards, Users, and Enrollments
  • Clean architecture: DTOs + Repository pattern (No Service Layer)
  • Many-to-Many enrollment with Enrollment entity
  • One-to-One mapping between Student ↔ IDCard, Student ↔ User
  • Unified API responses via ResponseBean<T>
  • Swagger/OpenAPI UI enabled
  • PostgreSQL integration with JPA/Hibernate
  • No business logic in services — all logic inside controllers

📁 Project Structure


student/
├── src/
│   ├── main/
│   │   ├── java/com/fsd/student/
│   │   │   ├── controller/         # REST controllers (DTO-based)
│   │   │   ├── dto/                # All request/response DTOs
│   │   │   ├── entity/             # JPA entities
│   │   │   ├── repository/         # Spring Data JPA repositories
│   │   │   ├── response/           # ResponseBean<T> wrapper
│   │   │   └── StudentApplication.java
│   │   └── resources/
│   │       └── application.properties
│   └── test/
│       └── java/com/fsd/student/StudentApplicationTests.java


🗃️ Entity Overview

Entity Description
Department Academic department (e.g. CS, IT)
Student Student profile (with Department & IDCard)
Subject Academic subject
Enrollment Join table for Many-to-Many (Student ↔ Subject)
StudentIDCard One-to-One with Student
User Authentication entity linked to Student

🔄 DTO Usage

All entities now use DTOs for input/output:

  • StudentDTO, DepartmentDTO, SubjectDTO, EnrollmentDTO, UserDTO, StudentIDCardDTO
  • Controllers map entities ↔ DTOs internally
  • JSON payloads are clean, flattened, and avoid recursion

⚙️ Tech Stack

  • Java 21
  • Spring Boot 3.x
  • Spring Data JPA
  • PostgreSQL
  • Lombok
  • Swagger/OpenAPI
  • Maven

🛠️ Setup Instructions

1. Clone this repository

git clone https://github.com/yourusername/student-management-backend.git
cd student-management-backend

2. Configure PostgreSQL in application.properties

spring.datasource.url=jdbc:postgresql://localhost:5432/studentdb
spring.datasource.username=your_db_user
spring.datasource.password=your_db_password
spring.jpa.hibernate.ddl-auto=update

3. Run the Project

mvn spring-boot:run

Or:

java -jar target/student-0.0.1-SNAPSHOT.jar

🔍 API Documentation

Swagger UI is enabled by default. After starting the app, visit:

http://localhost:8080/swagger-ui/index.html

✅ Example API Endpoints

Method Endpoint Description
GET /api/students List all students
POST /api/students Add new student
GET /api/subjects List all subjects
POST /api/enrollments Enroll student in subject
DELETE /api/users/{id} Delete a user

📦 Sample CURL - Create Enrollment

curl -X POST http://localhost:8080/api/enrollments \
-H "Content-Type: application/json" \
-d '{
  "studentId": "STU001",
  "subjectId": "SUBJ101",
  "enrollmentDate": "2025-07-14"
}'

📌 Developer Notes

  • Controllers use repositories directly (no service layer)
  • Business logic is controller-managed
  • DTOs used for cleaner request/response models
  • ResponseBean<T> ensures consistent success/error responses

✍️ Author

Sumeet Shah LinkedInGitHub


📝 License

Open-source under the MIT License

About

A Spring Boot REST API for academic management — manage students, subjects, departments, enrollments, ID cards, and user logins using a clean DTO-based architecture, PostgreSQL, and standardized JSON responses with ResponseBean. Built without service layers for simplicity and direct repository-controller interaction.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published