Skip to content

Siddhesh-source/DBMS

Repository files navigation

Exam Management System

A comprehensive web-based examination management system built with Next.js, TypeScript, and SQLite.

Features

For Administrators

  • Dashboard: Real-time statistics and monitoring
  • Exam Management: Create, edit, and manage exams
  • Question Bank: Manage questions with difficulty levels and types
  • Student Management: Add and manage student records
  • Course Management: Assign exams to courses
  • Results & Analytics: View and export exam results
  • Certificate Generation: Automatic certificate generation for passed exams

For Students

  • Dashboard: View available exams and performance
  • Take Exams: Timed exam interface with auto-save
  • View Results: Detailed performance analysis
  • Download Certificates: PDF certificates for passed exams

Tech Stack

  • Frontend: Next.js 16, React, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes
  • Database: SQLite with better-sqlite3
  • Authentication: JWT-based with bcrypt
  • PDF Generation: jsPDF for certificates

Getting Started

Prerequisites

  • Node.js 18+
  • npm or pnpm

Installation

  1. Clone the repository
git clone <repository-url>
cd exam-management-system
  1. Install dependencies
npm install
  1. Initialize the database
npm run db:seed
  1. Start the development server
npm run dev
  1. Open http://localhost:3000

Default Credentials

Admin

  • Email: admin@vitpune.ac.in
  • Password: admin123

Students

  • Email: student@vitstudent.ac.in
  • Password: student123

See TEST_CREDENTIALS.md for more test accounts.

Project Structure

exam-management-system/
├── app/                    # Next.js app directory
│   ├── admin/             # Admin pages
│   ├── student/           # Student pages
│   ├── api/               # API routes
│   └── login/             # Authentication
├── components/            # Reusable components
├── lib/                   # Utilities and services
│   ├── db/               # Database setup and schema
│   ├── services/         # Business logic
│   ├── middleware/       # Authentication middleware
│   └── utils/            # Helper functions
├── scripts/              # Database and utility scripts
└── public/               # Static assets

Key Features

Auto-Enrollment

New students are automatically enrolled in courses matching their department and semester.

Role-Based Access Control

  • Admin: Full system access
  • Student: Limited to their own data

Real-Time Dashboard

  • Live statistics
  • Auto-refresh every 30 seconds
  • Performance analytics

Exam Assignment

  • Assign exams to multiple courses
  • View affected students in real-time
  • Track enrollment status

Database Schema

See DBMS_CONCEPTS.md for detailed database design and relationships.

Main Tables

  • users - Authentication and roles
  • candidates - Student information
  • subjects - Academic subjects
  • courses - Course offerings
  • questions - Question bank
  • exams - Exam definitions
  • exam_attempts - Student exam sessions
  • results - Exam results
  • certifications - Generated certificates

API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout

Admin APIs

  • GET /api/admin/courses - List courses
  • GET /api/admin/questions - List questions
  • POST /api/admin/exams - Create exam
  • GET /api/admin/analytics - System analytics

Student APIs

  • GET /api/student/exams - Available exams
  • POST /api/exams/[id]/start - Start exam
  • POST /api/exams/[id]/submit - Submit exam
  • GET /api/student/results - View results
  • GET /api/student/certificates - Download certificates

Scripts

Database Management

npm run db:seed          # Seed database with sample data
npm run db:reset         # Reset and reseed database

Utility Scripts

npx tsx scripts/enroll-students-in-courses.ts    # Enroll students
npx tsx scripts/create-all-semester-courses.ts   # Create courses
npx tsx scripts/test-auto-enrollment.ts          # Test enrollment

Configuration

Environment Variables

Create a .env.local file:

JWT_SECRET=your-secret-key-here
NODE_ENV=development

Database Location

SQLite database is stored at: data/exam-system.db

Development

Running Tests

npm test

Building for Production

npm run build
npm start

Code Quality

npm run lint
npm run format

Features in Detail

Exam Creation

  1. Select subject and questions from question bank
  2. Set duration, passing marks, and schedule
  3. Assign to courses
  4. Publish when ready

Taking Exams

  1. Students see available exams on dashboard
  2. Click "Start Exam" to begin
  3. Timed interface with auto-save
  4. Submit when complete or time expires

Results & Certificates

  1. Automatic grading on submission
  2. Results visible immediately
  3. Certificates generated for passed exams
  4. PDF download available

Auto-Enrollment

  1. Create student with department and semester
  2. System finds matching courses
  3. Student automatically enrolled
  4. Appears in course rosters immediately

Troubleshooting

Database Issues

# Reset database
npm run db:reset

# Check database integrity
npx tsx scripts/verify-seed.ts

Authentication Issues

  • Clear browser cookies
  • Check JWT_SECRET in environment
  • Verify user exists in database

Enrollment Issues

# Check course availability
npx tsx scripts/check-durgesh.ts

# Enroll unenrolled students
npx tsx scripts/enroll-students-in-courses.ts

Security

  • Passwords hashed with bcrypt
  • JWT-based authentication
  • Role-based access control
  • SQL injection prevention (parameterized queries)
  • Protected API routes

Performance

  • Server-side rendering with Next.js
  • Optimized database queries
  • Efficient pagination
  • Auto-save for exams

Browser Support

  • Chrome (recommended)
  • Firefox
  • Safari
  • Edge

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For issues and questions:

  • Check DBMS_CONCEPTS.md for database design
  • Check TEST_CREDENTIALS.md for test accounts
  • Review API documentation above

Acknowledgments

Built with:

  • Next.js
  • React
  • TypeScript
  • Tailwind CSS
  • SQLite
  • better-sqlite3
  • bcrypt
  • jsonwebtoken
  • jsPDF

Version: 1.0.0
Last Updated: November 2025 Status: Production Ready ✅

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages