An open API service indexing awesome lists of open source software.

https://github.com/yukti-says/student-management-api

Role-based Student Management REST API using Node.js, Express, MongoDB, JWT. Built with MVC structure, teacher & student features included.
https://github.com/yukti-says/student-management-api

backend expressjs jwt-authentication mongodb mongodb-atlas mvc nodejs restapi

Last synced: 2 months ago
JSON representation

Role-based Student Management REST API using Node.js, Express, MongoDB, JWT. Built with MVC structure, teacher & student features included.

Awesome Lists containing this project

README

          

# ๐Ÿ“š Student Management System API

A role-based RESTful API built with Node.js, Express, and MongoDB for managing students, teachers, reports, and assignments โ€” using MVC architecture and JWT authentication.

---

## ๐Ÿš€ Features

- โœ… **User Roles:** Teacher and Student
- โœ… **JWT Authentication**
- โœ… **Secure Routing with Role-based Access**
- โœ… **Teachers can:**
- Add, Update, Delete, Get student by ID
- โœ… **Students can:**
- View their Assignments by student ID
- โœ… **Clean Folder Structure using MVC**
- โœ… Built with: `Node.js`, `Express`, `MongoDB`, `Mongoose`

---

## Live Deployed
[https://student-management-api-w0gc.onrender.com](https://student-management-api-w0gc.onrender.com)

---

## PostMan Tests

## ๐Ÿ“ธ Screenshots

User Registration:

![Auth](assets/screenshots/register.png) |

User Login:
![Teacher](assets/screenshots/login.png) |

---

## ๐Ÿงฑ Tech Stack

| Layer | Technology |
|-----------|------------------|
| Runtime | Node.js |
| Framework | Express.js |
| Database | MongoDB (Mongoose) |
| Auth | JWT + bcryptjs |
| Structure | MVC + Service Layer |

---

## ๐Ÿ“‚ Folder Structure

/backend
โ”œโ”€โ”€ /models
โ”œโ”€โ”€ /controllers
โ”œโ”€โ”€ /routes
โ”œโ”€โ”€ /services
โ”œโ”€โ”€ /middlewares
โ”œโ”€โ”€ /config
โ”œโ”€โ”€ server.js
โ””โ”€โ”€ .env

---

## ๐Ÿ” Roles

| Role | Access |
|---------|-------------------------------------------------|
| Teacher | Can add, delete, update, and search students |
| Student | Can view their assignments by ID |

---

## ๐Ÿงช API Endpoints

### ๐Ÿ” Auth

- `POST /api/auth/register` โ€“ Register with role (teacher/student)
- `POST /api/auth/login` โ€“ Login and receive JWT

### ๐Ÿ‘จโ€๐Ÿซ Teacher (Requires JWT + Role: teacher)

- `POST /api/teacher/add`
- `PUT /api/teacher/update/:id`
- `DELETE /api/teacher/delete/:id`
- `GET /api/teacher/student/:id`
- `GET /api/teacher/students` *(future enhancement)*

### ๐Ÿ‘ฉโ€๐ŸŽ“ Student (Requires JWT + Role: student)

- `GET /api/student/assignments/:id`

---

## ๐Ÿ› ๏ธ Setup & Run Locally

```bash
git clone https://github.com/yukti-says/student-management-api
cd student-management-api
npm install
```
### ๐Ÿ”ง Configure .env

```ini

PORT = 5000
MONGO_URI = "mongodb+srv://yuktiji:yuktiji@cluster0.a9q6ybi.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
JWT_SECRET = "yukti's good"
```

### โœ… Run Project

```nodemon server.js```

## ๐Ÿง  Learnings

MVC structure and clean code practices

JWT authentication + role-based middleware

Real-world API structure using Node.js & MongoDB

How to handle routes securely with middlewares

## ๐Ÿ’ก Future Enhancements

Report model + view

Assignment submissions

PDF generation

MongoDB Atlas hosting

Admin panel UI

## ๐Ÿค Connect with Me

Yukti Sahu










Twitter