A comprehensive backend API for managing academic institutions, including students, lecturers, heads of departments, and administrators.
- Students: Course registration, assignment submission, notifications
- Lecturers: Assignment creation, grading, course management, document sharing
- Head of Department (HoD): Course oversight, lecturer management, student administration
- Admin: System administration, user management, bulk operations
- Authentication & Authorization: JWT-based authentication with role-based access control
- File Management: GridFS integration for document storage and retrieval
- Course Management: Complete course lifecycle management
- Assignment System: Assignment creation, submission, and grading
- Notification System: Real-time notifications for all users
- Document Sharing: Secure file upload and download with folder organization
- Runtime: Node.js with Express.js
- Database: MongoDB with Mongoose ODM
- File Storage: GridFS for MongoDB
- Authentication: JWT tokens with bcrypt password hashing
- Validation: Express-validator for input validation
- Security: Helmet, CORS, rate limiting
- File Upload: Multer with GridFS storage
-
Clone the repository
git clone <repository-url> cd "application backend"
-
Install dependencies
npm install
-
Environment Setup
cp .env.example .env
Edit the
.envfile with your configuration:PORT=5000 MONGODB_URI=mongodb://localhost:27017/academic_management_system JWT_SECRET=your_jwt_secret_here JWT_REFRESH_SECRET=your_refresh_secret_here FRONTEND_URL=http://localhost:3000
-
Start MongoDB Make sure MongoDB is running on your system.
-
Run the application
# Development mode npm run dev # Production mode npm start
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profilePUT /api/auth/change-password- Change password
GET /courses- Get enrolled coursesPOST /courses/:id/register- Register for a courseGET /assignments- Get assignmentsPOST /assignments/:id/submit- Submit assignmentGET /notifications- Get notifications
GET /courses- Get assigned coursesPOST /assignments- Create assignmentGET /assignments/:id/submissions- Get assignment submissionsPUT /submissions/:id/grade- Grade submissionPOST /documents- Upload document
POST /courses- Create coursePOST /lecturers/:id/courses- Assign course to lecturerPOST /students/:id/register- Register student to courseGET /department/overview- Get department overviewPOST /notifications/send- Send notifications
POST /folders- Create folderPOST /documents- Upload documentGET /users/search- Search usersPOST /notifications- Send notificationPOST /notifications/bulk- Send bulk notificationGET /stats- Get system statistics
GET /download/:id- Download fileGET /stream/:id- Stream file (for videos/audio)
src/
├── app.js # Main application file
├── config/
│ ├── db.js # Database configuration
│ └── env.js # Environment configuration
├── controllers/
│ ├── admin/ # Admin controllers
│ ├── hod/ # HoD controllers
│ ├── lecturer/ # Lecturer controllers
│ ├── student/ # Student controllers
│ ├── authController.js # Authentication controller
│ └── fileController.js # File management controller
├── middleware/
│ ├── auth.js # Authentication middleware
│ ├── fileUpload.js # File upload middleware
│ ├── validation.js # Validation middleware
│ └── errorHandler.js # Global error handler
├── models/
│ ├── core/ # Core models (User, Department)
│ ├── academic/ # Academic models (Course, Assignment, etc.)
│ ├── content/ # Content models (Document, Folder)
│ └── communication/ # Communication models (Notification)
└── routes/
├── admin/ # Admin routes
├── hod/ # HoD routes
├── lecturer/ # Lecturer routes
├── student/ # Student routes
├── authRoutes.js # Authentication routes
├── fileRoutes.js # File management routes
└── index.js # Main routes file
- User: Base user model with role-based differentiation
- Department: Academic departments
- Course: Course information and management
- Assignment: Assignment details and requirements
- Submission: Student assignment submissions
- Grade: Grading system
- Enrollment: Course enrollment tracking
- Document: File metadata and storage information
- Folder: Hierarchical folder organization
- Notification: System notifications
npm run dev- Use ES6 modules and async/await
- Implement proper error handling
- Follow RESTful API conventions
- Use middleware for cross-cutting concerns
- Validate all inputs
- Implement proper authentication and authorization
Health check endpoint: GET /health
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt for password security
- Rate Limiting: Prevent API abuse
- CORS: Cross-origin resource sharing configuration
- Input Validation: Comprehensive input validation
- Role-based Access Control: Fine-grained permissions
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.