Skip to content

RaviGit18/StudentManagement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Student Management System

A Spring Boot application for managing student records with MongoDB integration.

Overview

This Student Management System provides RESTful APIs to perform CRUD operations on student data. The application uses Spring Boot with MongoDB as the database and follows a layered architecture with controllers, services, repositories, and models.

Tech Stack

  • Java 21
  • Spring Boot 4.0.1
  • MongoDB (Database)
  • Spring Data MongoDB
  • Spring Web MVC
  • Lombok (For reducing boilerplate code)
  • Maven (Build tool)

Features

  • Add single or multiple student records
  • Retrieve all student data
  • Fetch student by ID
  • Search students by name and CGPA
  • Find students by city
  • Query students by country or arrears status
  • Filter students by enrollment date range

Student Data Model

The application stores the following student information:

  • ID: Unique identifier (auto-generated)
  • Name: Student's full name
  • CGPA: Cumulative Grade Point Average
  • Has Arrears: Boolean indicating if student has pending arrears
  • Course List: List of courses the student is enrolled in
  • Address: Student's address details
  • Enrollment Date: Date of student enrollment (format: dd-MM-yyyy)

API Endpoints

Student Management

Method Endpoint Description
POST /student/addStudent Add a single student
POST /student/addStudentsData Add multiple students
GET /student/getAllStudentsData Get all students
GET /student/getStudentById/{id} Get student by ID
GET /student/getStudentByNameAndCgpa Get students by name and CGPA
GET /student/getStudentByCity/{city} Get student by city
GET /student/getStudentByCountryOrArrears Get students by country or arrears
GET /student/getStudentByEnrollmentDate Get students by enrollment date

Prerequisites

  • Java 21 or higher
  • Maven 3.6 or higher
  • MongoDB instance running on localhost:27017

Installation and Setup

  1. Clone the repository

    git clone <repository-url>
    cd StudentManagement
  2. Configure MongoDB

    • Ensure MongoDB is running on localhost:27017
    • Create a database named student (or modify the configuration in application.properties)
  3. Build the application

    mvn clean install
  4. Run the application

    mvn spring-boot:run

    The application will start on http://localhost:8080

Configuration

The application configuration is located in src/main/resources/application.properties:

spring.application.name=StudentManagement

# MongoDB properties
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=student

Usage Examples

Add a Student

curl -X POST http://localhost:8080/student/addStudent \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ravi Ranjan",
    "cgpa": 8.0,
    "hasArrears": false,
    "courseList": ["Mathematics", "Physics", "Computer Science"],
    "address": {
      "street": "Salt Lake, Sector 2",
      "city": "Kolkata",
      "country": "IN"
    },
    "enrollmentDate": "15-01-2023"
  }'

Get All Students

curl http://localhost:8080/student/getAllStudentsData

Get Student by ID

curl http://localhost:8080/student/getStudentById/{student-id}

Search by Name and CGPA

curl "http://localhost:8080/student/getStudentByNameAndCgpa?name=John&cgpa=8.5"

Project Structure

src/main/java/com/example/StudentManagement/
├── StudentManagementApplication.java    # Main application class
├── controller/
│   └── StudentController.java          # REST API endpoints
├── modal/
│   ├── Student.java                    # Student entity
│   └── Address.java                    # Address entity
├── repository/
│   └── StudentRepository.java          # Data access layer
└── service/
    └── StudentService.java             # Business logic layer

Development

Running Tests

mvn test

Development Tools

The application includes Spring Boot DevTools for automatic restart during development.

image image

About

A Spring Boot application for managing student records with MongoDB integration. This provides provides RESTful APIs to perform CRUD operations on student data. The application uses Spring Boot with MongoDB as the database and follows a layered architecture with controllers, services, repositories, and models.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages