Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Student Management System

A full-stack Student Management System built with Spring Boot, PostgreSQL, and React. The application provides a focused single-page interface for managing student records with search, filtering, sorting, pagination, and complete CRUD operations.

Overview

This project includes:

  • A Spring Boot REST API for student management
  • A PostgreSQL database for persistence
  • A React + Vite frontend with a modern dark UI
  • Server-side filtering, sorting, and pagination
  • Validation and structured error handling for form submissions

Tech Stack

Backend

  • Java 21
  • Spring Boot
  • Spring Web MVC
  • Spring Data JPA
  • Jakarta Validation
  • PostgreSQL

Frontend

  • React
  • Vite
  • JavaScript
  • Tailwind CSS
  • Axios
  • lucide-react

Features

  • View all students
  • Search students by name
  • Filter students by department
  • Filter students by minimum and maximum CGPA
  • Sort by name or CGPA
  • Server-side pagination
  • Add a student
  • Edit an existing student
  • Delete a student with confirmation
  • Summary cards for total students, average CGPA, and departments
  • Validation error display and duplicate email handling

Project Structure

student-management-spring/
|-- src/
|   |-- main/
|   |   |-- java/com/sriragul/studentmanagement/
|   |   |   |-- config/
|   |   |   |-- controller/
|   |   |   |-- dto/
|   |   |   |-- entity/
|   |   |   |-- exception/
|   |   |   |-- repository/
|   |   |   |-- service/
|   |   |   |-- specification/
|   |   |-- resources/
|-- frontend/
|   |-- src/
|   |   |-- api/
|   |   |-- components/
|   |   |-- pages/
|-- pom.xml
|-- README.md

Backend API

Base URL:

http://localhost:8081/api/students

Endpoints

Method Endpoint Description
GET /api/students Fetch all students
GET /api/students/{id} Fetch a student by id
POST /api/students Create a student
PUT /api/students/{id} Update a student
DELETE /api/students/{id} Delete a student
GET /api/students/search Search, filter, sort, and paginate students

Search and Pagination Parameters

The /api/students/search endpoint supports:

  • name
  • department
  • minCgpa
  • maxCgpa
  • page
  • size
  • sort

Example:

GET /api/students/search?name=an&department=CSE&minCgpa=7.5&maxCgpa=9.5&page=0&size=8&sort=name,asc

Example Request Body

{
  "name": "Ananya Sharma",
  "email": "ananya@example.com",
  "department": "CSE",
  "cgpa": 8.76
}

Validation and Error Responses

Field-level validation errors:

{
  "name": "Name is required",
  "email": "Enter a valid email address"
}

General errors such as duplicate email:

{
  "message": "Email already exists: ananya@example.com"
}

Frontend Behavior

The frontend does not perform local filtering on the table data. Instead:

  • It collects search, department, CGPA, sort, and pagination inputs
  • It sends those values to /api/students/search
  • The backend performs filtering, sorting, and pagination
  • The frontend renders the Spring Page response

This keeps the UI aligned with the actual backend dataset and makes combined filters work correctly.

Getting Started

Prerequisites

  • Java 21
  • Maven
  • Node.js
  • npm
  • PostgreSQL

1. Clone the Repository

git clone <your-repository-url>
cd student-management-spring

2. Configure the Database

Update application.properties with your local PostgreSQL settings.

Current properties include:

  • Database name: student_db
  • Port: 5432
  • Backend port: 8081

Recommended: replace hardcoded local credentials with values appropriate for your machine before sharing or deploying the project.

3. Run the Backend

From the project root:

./mvnw spring-boot:run

On Windows:

mvnw.cmd spring-boot:run

The backend will start on:

http://localhost:8081

4. Run the Frontend

Open a second terminal:

cd frontend
npm install
npm run dev

The frontend will start on:

http://localhost:5173

Available Frontend Scripts

Inside the frontend directory:

npm run dev
npm run build
npm run preview
npm run lint

Build and Verification

Frontend production build:

cd frontend
npm run build

Frontend lint:

cd frontend
npm run lint

Backend tests:

./mvnw test

Key Implementation Notes

  • CRUD operations are handled through the Spring REST API
  • Filtering and pagination are server-side
  • Validation is handled by Jakarta Validation on the backend
  • Duplicate email errors are returned through a global exception handler
  • The frontend uses a shared modal for add and edit flows
  • Delete uses a custom confirmation dialog instead of browser alerts

Future Improvements

  • Move database credentials to environment variables
  • Add Docker support
  • Add authentication and role-based access control
  • Add API documentation with Swagger/OpenAPI
  • Add unit and integration tests for frontend components
  • Add deployment configuration

Author

Developed as a full-stack Student Management System project using Spring Boot and React.

About

A Spring Boot REST API for managing student records with CRUD operations, PostgreSQL integration, filtering, sorting, and pagination.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages