This repository implements a lightweight course feedback system used to collect, aggregate and review student evaluations of courses and lecturers.
Features at a glance:
- Student dashboard to submit ratings, per-lecturer ratings, and comments.
- Teacher dashboard to view aggregated feedback for courses.
- Admin dashboard to manage courses and lecturers and assign lecturers to courses.
- MongoDB-backed persistence and a single-file Node.js HTTP server (
server.js).
Prerequisites:
- Node.js (14+ recommended)
- A MongoDB instance (local or Atlas)
- Install dependencies:
npm install- Configure environment (create a
.envor export env vars):
# Example (PowerShell)
$env:MONGODB_URI='mongodb://localhost:27017'
node server.js- Start the server (example):
node server.jsBy default the server will connect to the course_feedback_app database and serve static files from the public/ folder. The server prints the listening port and confirms MongoDB connection on startup.
MONGODB_URI— MongoDB connection string (required for DB-backed mode).ADMIN_KEY— Shared admin authorization key (default:admin123if not set).PORT— HTTP port (default:3000if not set).
Public endpoints:
GET /api/health— Simple health check.GET /api/courses— List courses. Supports?level=filter.POST /api/feedback— Submit student feedback. Payload example:
{
"courseCode": "CSC101",
"level": 100,
"rating": 4,
"lecturerRatings": [{ "lecturerId": "<id>", "rating": 5 }],
"comments": "Great course",
"wantsResponse": false
}GET /api/feedback— Aggregated feedback (supports?level=).
Admin endpoints (require header Authorization: Bearer <ADMIN_KEY>):
GET /api/admin/coursesPOST /api/admin/courses— Create course (body:{ code, name, level, lecturerId? }).PUT /api/admin/courses/:code— Update course.DELETE /api/admin/courses/:code— Remove course.GET /api/admin/lecturersPOST /api/admin/lecturers— Create lecturer (body:{ name, role: "lecturer" }).PUT /api/admin/lecturers/:idDELETE /api/admin/lecturers/:id
Security note: the server validates that lecturerId assignments reference a user with role lecturer.
coursescollection:{ code, name, level, lecturerId?, lecturerName? }lecturerscollection:{ _id, name, role }(role expected to belecturer)feedbackcollection: stores per-course aggregated records and raw entries used to compute averages
- The server is implemented in
server.js(vanilla Node.js HTTP server). It connects to MongoDB and seeds default course and lecturer data on first run. - Frontend is under
public/:public/admin-dashboard.html+public/js/admin.js— Admin UI and logic.public/student-dashboard.html+public/js/student.js— Student UI.public/teacher-dashboard.html— Teacher UI (reads aggregated feedback).
An automated smoke test for admin flows is available at scripts/admin-smoke-test.js.
# Example (PowerShell)
$env:BASE_URL='http://localhost:3006'
node scripts/admin-smoke-test.js- Replace single-key admin auth with proper accounts (JWTs/passwords).
- Add rate-limiting, input sanitization for displayed HTML, and production hardening.
- Optionally add per-lecturer login and a view filtered to assigned courses.
MIT — see LICENSE file if provided.