Skip to content

A secure Full Stack Student Management System with authentication, CRUD, image uploads, live search, custom pagination, validation, and rate limiting. Built with Node.js, Express, MongoDB, JWT, Bootstrap, and Vanilla JavaScript.

License

Notifications You must be signed in to change notification settings

asim249/Students-Management-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 Student Management System (Full Stack)

A secure and feature-rich Student Management System built using Node.js, Express, MongoDB, JWT Authentication, Bootstrap, and Vanilla JavaScript. It includes authentication, CRUD operations, image upload & cleanup, live searching, pagination, validation, and rate-limiting.


🚀 Features

🔐 Authentication (JWT + LocalStorage)

Admin can Register → Auto Login → Redirect to Dashboard.

Login with username & password.

JWT stored in LocalStorage, expires in 1 hour.

Logout clears token and redirects to login page.


👨‍🎓 Student Management (CRUD)

Add Student: First Name, Last Name, Email, Phone, Gender, Profile Picture.

View Student: Single student record in a dynamic modal.

Edit Student: Auto-fill form → Update details dynamically.

Delete Student: Confirm box → Deletes student & image from server.


🖼 Image Handling

Profile picture upload with Multer.

On Update → Old image deleted, replaced by new image.

On Delete → Student’s profile picture also removed.


🔍 Advanced Functionalities

Live Search (by first name, last name, email).

Pagination without any npm package (custom logic in Vanilla JS).


🛡 Security Features

JWT Authentication Middleware for protected routes.

Rate Limiting (via express-rate-limit):

Max 30 requests per minute per IP.

Prevents brute force / spam attacks.


Input Validation (via express-validator):

Validates first name, last name, email, phone, gender, etc.

Automatically removes uploaded file if validation fails.


🛠️ Tech Stack

Frontend

HTML5

Bootstrap 5

Vanilla JavaScript


Backend

Node.js

Express.js

MongoDB + Mongoose


Security & Utilities

JWT (JSON Web Tokens)

bcrypt.js (Password Hashing)

Multer (File Uploads)

express-validator (Form Validation)

express-rate-limit (Rate Limiting)

dotenv (Environment Config)

cors (Cross-Origin Resource Sharing)


⚡ Middleware & Error Handling

auth.js → Verifies JWT before accessing /api/students.

RateLimiter → Blocks abusive requests (max 30/min).

Validation → Checks all input fields, deletes invalid uploads.

Error Handler → Handles MulterError (invalid file uploads) & generic server errors.


📦 Dependencies

  • bcryptjs: ^3.0.2
  • cors: ^2.8.5
  • dotenv: ^17.2.2
  • express: ^5.1.0
  • express-rate-limit: ^8.1.0
  • express-validator: ^7.2.1
  • jsonwebtoken: ^9.0.2
  • mongoose: ^8.18.0
  • multer: ^2.0.2
  • nodemon: ^3.1.10

📂 Project Structure

STUDENT-CRUD/ │

├── backend/ # Backend (Node.js + Express + MongoDB)

│ ├── config/

│ │ └── database.js # MongoDB connection setup

│ ├── middleware/ │ │ └── auth.js # JWT authentication middleware

│ ├── models/ │ │ ├── student.model.js # Student schema & model

│ │ └── user.model.js # User/Admin schema & model

│ ├── routes/

│ │ ├── student.routes.js # Student CRUD routes

│ │ └── user.routes.js # User authentication routes

│ ├── uploads/ # Stores uploaded profile pictures

│ ├── .env # Environment variables (PORT, DB, JWT secret)

│ ├── index.js # Entry point (server setup, middlewares, routes)

│ ├── package.json # Backend dependencies & scripts

│ └── package-lock.json

├── frontend/ # Frontend (HTML + Bootstrap + Vanilla JS)

│ ├── Authentication/

│ │ ├── authentication.js # Auth logic (login, register, logout)

│ │ ├── login.html # Login page

│ │ └── register.html # Register page

│ ├── index.html # Dashboard / Students listing page

│ └── index.js # Handles student CRUD, search, pagination

├── README.md # Project documentation

└── .vscode/ # VS Code settings


⚙️ Installation & Setup

git clone https://github.com/asim249/Students-Management-App.git cd Student-Mangment-App

2️⃣ Install Dependencies

cd backend npm install

3️⃣ Environment Variables

Create a .env file in backend root:

PORT=3000 MONGO_URI=mongodb://localhost:27017/studentdb JWT_SECRET_KEY=your_secret_key

4️⃣ Run Server

npm start

5️⃣ Open Frontend

Open frontend/index.html in browser (use Live Server or directly).


🔑 API Endpoints

Authentication Routes

Method Endpoint Description
POST /api/users/register Register new admin
POST /api/users/login Login & receive JWT
POST /api/users/logout Logout user

Student Routes

Method Endpoint Description
GET /api/students Get all students (with search + pagination)
GET /api/students/:id Get single student
POST /api/students Add new student (with image)
PUT /api/students/:id Update student (replace image if provided)
DELETE /api/students/:id Delete student + image

🎥 Demo

Student Management App Demo


🧑‍💻 Developer

Developed by Asim Mir
GitHub: asim249


📜 License

This project is licensed under the MIT License.

About

A secure Full Stack Student Management System with authentication, CRUD, image uploads, live search, custom pagination, validation, and rate limiting. Built with Node.js, Express, MongoDB, JWT, Bootstrap, and Vanilla JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published