The Student Management System is a platform that manages student data, tasks, and administrative functionalities. Built on a Node.js backend using the Express framework, enhanced by TypeScript, the system provides separate functionalities for students and admins, secured with JWT (JSON Web Tokens) for authentication and authorization.
The platform has two main sections:
-
Admin Section: For teachers and staff. It lets them easily add students, give tasks, and make new admin accounts.
-
Student Section: For students. They can see their tasks, change their profile details, and update task progress.
-
Admin Features
- Login
- Create a new Admin
- Add a student
- Assign tasks to students
-
Student Features
- Login
- View assigned tasks
- Update task status
- controllers/
- admin.ts # Admin related functionalities
- student.ts # Student related functionalities
- middleware/
- auth.middleware.ts # JWT-based authentication & authorization
- models/
- task.model.ts # Schema & Model for Tasks
- user.model.ts # Schema & Model for Users (Admins & Students)
- routes/
- v1/
- admin/
- admin.routes.ts # Routes related to Admin actions
- student/
- student.routes.ts # Routes related to Student actions
- index.ts # Central route file importing all versioned routes
- utils/
- responseCodes.ts # Utility to handle HTTP responses
-
Login:
POST /api/v1/admin/login
- Description: This endpoint allows administrators to log in by providing their credentials. Upon successful validation, a session or JWT token is returned.
- Payload:
{ "email": "[email protected]", "password": "adminpassword" }
-
Add Student:
POST /api/v1/admin/add
- Description: Administrators can use this endpoint to add new students to the system. The provided data will be stored securely, and the student will be able to access the system using the given email and password.
- Payload:
{ "name": "John Doe", "email": "[email protected]", "department": "Engineering", "password": "johnpassword" }
-
Assign Task to Student:
POST /api/v1/admin/assign
- Description: Admins can assign specific tasks to students. Each task has a title, description, and due date. Once assigned, the student can view the task and update its status.
- Payload:
{ "studentId": "5f9a3234238dc10f834b23cd", "taskName": "Assignment 1", "dueDate": "2023-11-20", "description": "Complete the assignment on calculus." }
-
Create New Admin:
POST /api/v1/admin/createAdmin
- Description: In cases where more than one administrator is required, this endpoint enables the creation of additional admin accounts. The new admin can then access the system using the given credentials.
- Payload:
{ "name": "Admin2", "email": "[email protected]", "department": "Admin", "password": "adminpassword2" }
-
Login:
POST /api/v1/student/login
- Description: Students can log into the system using this endpoint. Upon successful authentication, they are granted access to their dashboard and can view their tasks.
- Payload:
{ "email": "[email protected]", "password": "johnpassword" }
-
Get Tasks:
GET /api/v1/student/tasks/:id
- Description: This endpoint retrieves all the tasks assigned to a particular student categorised by status. By providing the student's ID, the system will return a list of all associated tasks.
:id
- ID of the student for whom the tasks need to be fetched.
-
Update Task Status:
PATCH /api/v1/student/update/:taskId
- Description: Students can update the status of their tasks, indicating their progress or completion. The task status is updated in real-time for administrators to monitor.
:taskId
- ID of the task to be updated- Payload:
{ "status": "completed" }
- verifyUser: Middleware to verify and authenticate a user (student) based on the provided JWT token.
- verifyAdmin: Middleware to verify, authenticate, and authorize an admin based on the provided JWT token.
- Task Model: Represents tasks with properties such as title, description, due date, and status.
- User Model: Represents users (students and admins) with properties like name, email, password, department, role (admin/student), and tasks.
- Clone the repository.
- Build the code using
npm run build
to install dependencies. - Please refer to the email which I have sent for the
.env
file. - Run the server using
npm run start
. - Access the APIs using tools like Postman.
-
Backend Deployment: The backend of this project has been deployed on an AWS EC2 instance. You can access it at the following link: https://student-management-api.workwise.gq/api/v1/
-
API Documentation: For detailed API documentation, please visit the following link: API Documentation