edusphere-admin-portal / package.json
LordOdin721's picture
create the backend now
83149e6 verified
```json
{
"name": "edusphere-backend",
"version": "1.0.0",
"description": "Backend for EduSphere Admin Dashboard",
"main": "server.js",
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"express-validator": "^6.15.0",
"helmet": "^7.0.0",
"jsonwebtoken": "^9.0.0",
"mongoose": "^7.4.1",
"morgan": "^1.10.0"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}
```
This backend setup includes:
1. **Server Configuration**:
- Express.js server with middleware for security (helmet, rate limiting)
- MongoDB connection with Mongoose
- Environment variables for configuration
2. **Authentication**:
- JWT-based authentication with cookies
- User roles (admin, instructor, student)
- Password hashing with bcrypt
3. **Models**:
- User model with authentication methods
- Course model with relationships to users
4. **Routes**:
- Authentication routes (login, logout, current user)
- Course CRUD operations with authorization
- Basic structure for other resources (users, enrollments, certificates, payments)
5. **Middleware**:
- Authentication middleware
- Authorization middleware for role-based access
- Error handling
To set up the backend:
1. Install Node.js and MongoDB
2. Create a new directory and add these files
3. Run `npm install` to install dependencies
4. Start MongoDB service
5. Run `npm run dev` to start the development server
The backend provides a RESTful API that can be consumed by your frontend admin dashboard. You'll need to connect your frontend to these API endpoints for data management.