A comprehensive web-based examination platform that enables educational institutions to conduct secure online exams with automatic grading, real-time monitoring, and detailed analytics.
- Student Management: Create student accounts with auto-generated secure passwords
- Exam Creation: Build exams with multiple-choice questions and customizable duration
- Question Bank: Visual editor with bottom navigation for easy question management
- Result Analytics: Comprehensive statistics with filters and Excel export
- Access Control: Activate/deactivate exams and manage student access
- Dashboard: Real-time overview of students, exams, and submissions
- User-Friendly Interface: Clean, intuitive dashboard showing available exams
- Exam Experience:
- Real-time countdown timer with auto-submit
- Bottom question navigator with color-coded progress
- Auto-save answers
- Visual feedback for answered questions
- Instant Results: Automatic grading with detailed performance analysis
- Result History: View all past exam results with statistics
- No Retakes: Exam integrity maintained with single-attempt restriction
- Automatic Grading: Instant score calculation upon submission
- JWT Authentication: Secure token-based authentication system
- Role-Based Access: Separate admin and student portals
- Responsive Design: Works seamlessly on desktop and mobile devices
- Excel Export: Download detailed result reports in Excel format
- Professional UI: Modern design with TailwindCSS
- Runtime: Node.js v18+
- Language: TypeScript
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Password Security: bcrypt
- Excel Generation: ExcelJS
- Template Engine: EJS (Embedded JavaScript)
- CSS Framework: TailwindCSS (CDN)
- Icons: Font Awesome
- Animations: CSS transitions and keyframes
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- MongoDB (v6.0 or higher)
- npm or yarn package manager
git clone https://github.com/yourusername/online-exam-system.git
cd online-exam-system
npm install
Create a .env file in the root directory:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/online_exam_system
# JWT Secret (use a strong random string)
JWT_SECRET=your_super_secret_jwt_key_here_change_this_in_production
# JWT Expiration
JWT_EXPIRE=7d
# On Linux/Mac
sudo systemctl start mongod
# Or using MongoDB Compass GUI
npm run create-admin
This will create an admin account with:
- Email:
admin@example.com - Password:
admin123
# Development mode with auto-reload
npm run dev
# Production mode
npm run build
npm start
The application will be available at http://localhost:3000
online-exam-system/
โโโ src/
โ โโโ config/
โ โ โโโ database.ts # MongoDB connection
โ โโโ controllers/
โ โ โโโ adminAuth.controller.ts
โ โ โโโ admin.controller.ts
โ โ โโโ studentAuth.controller.ts
โ โ โโโ exam.controller.ts
โ โ โโโ question.controller.ts
โ โ โโโ result.controller.ts
โ โโโ middleware/
โ โ โโโ auth.middleware.ts # JWT authentication
โ โโโ models/
โ โ โโโ Admin.ts
โ โ โโโ Student.ts
โ โ โโโ Exam.ts
โ โ โโโ Question.ts
โ โ โโโ Result.ts
โ โโโ routes/
โ โ โโโ adminAuth.routes.ts
โ โ โโโ admin.routes.ts
โ โ โโโ studentAuth.routes.ts
โ โ โโโ exam.routes.ts
โ โ โโโ question.routes.ts
โ โ โโโ result.routes.ts
โ โ โโโ view.routes.ts
โ โ โโโ index.ts
โ โโโ types/
โ โ โโโ express.types.ts # TypeScript type definitions
โ โโโ utils/
โ โ โโโ password.utils.ts
โ โ โโโ password-generator.utils.ts
โ โ โโโ token.utils.ts
โ โ โโโ validation.utils.ts
โ โ โโโ excel.utils.ts
โ โโโ views/
โ โ โโโ partials/
โ โ โ โโโ head.ejs
โ โ โ โโโ header.ejs
โ โ โ โโโ footer.ejs
โ โ โโโ home.ejs
โ โ โโโ login.ejs
โ โ โโโ admin-dashboard.ejs
โ โ โโโ admin-students.ejs
โ โ โโโ admin-exams.ejs
โ โ โโโ admin-questions.ejs
โ โ โโโ admin-results.ejs
โ โ โโโ student-dashboard.ejs
โ โ โโโ student-results.ejs
โ โ โโโ take-exam.ejs
โ โ โโโ exam-result.ejs
โ โโโ index.ts # Main server file
โโโ public/
โ โโโ css/
โ โโโ input.css # Custom styles
โโโ scripts/
โ โโโ create-admin.ts # Admin creation script
โโโ .env # Environment variables
โโโ .gitignore
โโโ package.json
โโโ tsconfig.json
โโโ README.md
- Login: Access
/loginand select "Admin" tab - Create Students: Go to Students page and add student accounts
- Create Exams: Navigate to Exams page and create a new exam
- Add Questions: Click "Manage Questions" on any exam to add MCQs
- Activate Exam: Toggle exam status to make it available to students
- Monitor Results: View submissions and analytics in Results page
- Export Data: Download Excel reports for detailed analysis
- Login: Access
/loginwith credentials provided by admin - View Exams: See all available exams on dashboard
- Start Exam: Click "Start Exam" to begin (cannot retake)
- Take Exam: Answer questions using the visual navigator
- Submit: Submit before timer expires or it auto-submits
- View Result: See instant results with grade and performance analysis
- Check History: View all past results in Results page
Admin
- Email:
admin@example.com - Password:
admin123
Students
- Passwords are auto-generated when admin creates accounts
- Admin can reset student passwords anytime
POST /api/admin/auth/login - Admin login
GET /api/admin/auth/profile - Get admin profile
POST /api/student/auth/login - Student login
GET /api/student/auth/profile - Get student profile
PUT /api/student/auth/change-password - Change password
POST /api/admin/students - Create student
GET /api/admin/students - Get all students
GET /api/admin/students/:id - Get student by ID
PUT /api/admin/students/:id - Update student
DELETE /api/admin/students/:id - Delete student
POST /api/admin/students/:id/reset-password - Reset password
POST /api/exams - Create exam (Admin)
GET /api/exams - Get all exams
GET /api/exams/:id - Get exam by ID
PUT /api/exams/:id - Update exam (Admin)
DELETE /api/exams/:id - Delete exam (Admin)
PATCH /api/exams/:id/toggle-status - Toggle exam status (Admin)
POST /api/exams/:examId/questions - Add question (Admin)
GET /api/exams/:examId/questions - Get questions
GET /api/questions/:id - Get question by ID (Admin)
PUT /api/questions/:id - Update question (Admin)
DELETE /api/questions/:id - Delete question (Admin)
POST /api/results/submit - Submit exam (Student)
GET /api/results/my-results - Get student's results (Student)
GET /api/results/:id - Get result by ID
GET /api/results/exam/:examId - Get exam results (Admin)
GET /api/results - Get all results (Admin)
GET /api/results/export - Export to Excel (Admin)
In .env file:
JWT_SECRET=your_new_secret_key_minimum_32_characters_long
PORT=8080
MONGODB_URI=mongodb://username:password@host:port/database
npm install -g pm2
npm run build
pm2 start dist/index.js --name "online-exam-system"
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/index.js"]
# Test admin creation
npm run create-admin
# Test API endpoints (using your preferred tool)
# Postman, Thunder Client, or curl
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Excel export requires modern browser with Blob support
- Timer continues in background if tab is inactive (by design)
- Mobile view optimized for portrait mode
- Bulk question import from CSV/Excel
- Question categories and difficulty levels
- Randomized question order per student
- Detailed answer review after exam
- Email notifications for results
- Advanced analytics with charts
- Multi-language support
- Dark mode theme
- TailwindCSS for the beautiful UI framework
- MongoDB for the robust database
- Express.js for the powerful backend framework
- Font Awesome for the icon library
Built with โค๏ธ using Node.js, TypeScript, MongoDB & TailwindCSS