Skip to content

A comprehensive online quiz management system built with Django REST API and React. Features real-time proctoring, multi-tenant architecture, group management, and advanced analytics for educational institutions and organizations.

License

Notifications You must be signed in to change notification settings

Kawchar-Ahammed/Smart-Quiz-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Smart Quiz System

A comprehensive, enterprise-grade online assessment platform with advanced proctoring, multi-tenant support, and real-time analytics.

License: MIT Django React SQL Server

🌟 Key Features

🎯 Assessment Management

  • Multiple Question Types: MCQ, True/False, Short Answer, Essay, Matching
  • Smart Randomization: Question and answer order randomization
  • Flexible Scheduling: Start/end dates with automatic expiration
  • Attempts Control: Configurable maximum attempts per quiz
  • Instant Grading: Automatic scoring with manual review options

🏢 Multi-Tenant Architecture

  • Organization Management: Complete multi-tenancy support
  • Role-Based Access: Admin, Instructor, Student roles with granular permissions
  • Group Management: Course groups, study groups, public groups, self-assessment
  • Subscription Tiers: Basic, Premium, Enterprise with feature gating

🔒 Advanced Security & Proctoring

  • SmartMonitor: Real-time proctoring with violation detection
  • JWT Authentication: Secure token-based authentication
  • Tab Monitoring: Detection of tab switches and window focus changes
  • Copy/Paste Prevention: Advanced cheating prevention mechanisms
  • CSRF Protection: Complete protection against common attacks

📊 Analytics & Reporting

  • Real-Time Dashboards: Live statistics and performance metrics
  • Detailed Analytics: Student progress tracking and performance analysis
  • Comprehensive Reports: Quiz analytics, user statistics, system overview
  • Export Capabilities: Data export for further analysis

🔔 Communication & Notifications

  • Email Integration: Automated notifications for quiz completion, assignments
  • Template System: Customizable email templates
  • Real-Time Updates: Live notifications for important events
  • Group Invitations: Seamless collaboration features

🏗️ Architecture Overview

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   React.js      │    │   Django REST   │    │  SQL Server     │
│   Frontend      │◄──►│   API Backend   │◄──►│   Database      │
│                 │    │                 │    │                 │
│ • TailwindCSS   │    │ • JWT Auth      │    │ • Normalized    │
│ • React Router  │    │ • DRF           │    │ • Indexed       │
│ • Axios         │    │ • Celery Tasks  │    │ • Scalable      │
│ • Context API   │    │ • Redis Cache   │    │ • ACID          │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Technology Stack

Frontend

  • React 18.2 - Modern UI with hooks and context
  • TailwindCSS - Utility-first styling framework
  • Axios - HTTP client with interceptors
  • React Router - SPA routing with protected routes
  • React Query - Server state management
  • Chart.js - Interactive data visualizations

Backend

  • Django 4.2.7 - Robust web framework
  • Django REST Framework - Powerful API development
  • JWT Authentication - Secure token-based auth
  • Celery + Redis - Background task processing
  • WhiteNoise - Static file serving
  • CORS Headers - Cross-origin request handling

Database & Infrastructure

  • Microsoft SQL Server - Enterprise-grade database
  • Redis - Caching and task queue
  • Email Integration - SMTP support with templates
  • File Storage - Configurable static/media handling

🚀 Quick Start

Prerequisites

# Required software
Python 3.9+
Node.js 16+
SQL Server 2019+ (or SQL Server Express)
Redis (optional, for background tasks)

1. Clone & Setup

# Clone the repository
git clone https://github.com/yourusername/smart-quiz-system.git
cd smart-quiz-system

# Quick setup (Windows)
setup.bat

# Or manual setup below...

2. Backend Setup

cd backend

# Create virtual environment
python -m venv venv
venv\Scripts\activate  # Windows
# source venv/bin/activate  # Linux/macOS

# Install dependencies
pip install -r requirements.txt

# Configure environment
copy .env.example .env
# Edit .env with your database credentials

# Database setup
python manage.py migrate
python manage.py createsuperuser

# Start development server
python manage.py runserver

3. Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm start

4. Database Configuration

-- Execute the enhanced schema
sqlcmd -S localhost -d SmartQuizDB -i database/enhanced_schema.sql

5. Access the Application

📁 Project Structure

smart-quiz-system/
├── 📁 backend/                     # Django REST API
│   ├── 📁 smart_quiz_system/       # Main Django project
│   ├── 📁 apps/                    # Django applications
│   │   ├── 📁 authentication/     # User management & JWT
│   │   ├── 📁 organizations/      # Multi-tenant support
│   │   ├── 📁 groups/             # Group management system
│   │   ├── 📁 quizzes/            # Quiz & question management
│   │   ├── 📁 results/            # Quiz attempts & scoring
│   │   ├── 📁 proctoring/         # SmartMonitor system
│   │   └── 📁 notifications/      # Email & notifications
│   ├── 📄 requirements.txt        # Python dependencies
│   └── 📄 manage.py               # Django management
├── 📁 frontend/                    # React Application
│   ├── 📁 public/                 # Static assets
│   ├── 📁 src/                    # React source code
│   │   ├── 📁 components/         # Reusable components
│   │   ├── 📁 pages/              # Page components
│   │   ├── 📁 services/           # API services
│   │   ├── 📁 context/            # React context providers
│   │   └── 📁 hooks/              # Custom React hooks
│   ├── 📄 package.json           # Node dependencies
│   └── 📄 tailwind.config.js     # TailwindCSS configuration
├── 📁 database/                   # Database scripts
│   ├── 📄 SmartQuizDB_SQLServer.sql     # Original schema
│   ├── 📄 enhanced_schema.sql           # Enhanced features
│   └── 📄 sample_data.sql              # Development data
├── 📁 docs/                       # Documentation
│   ├── 📄 SECURITY_FIXES.md       # Security improvements
│   ├── 📄 PERFORMANCE_GUIDE.md    # Performance optimization
│   ├── 📄 TESTING_STRATEGY.md     # Testing implementation
│   └── 📄 PRODUCTION_DEPLOYMENT.md # Deployment guide
└── 📄 README.md                   # This file

🔧 Configuration

Environment Variables

Create a .env file in the backend directory:

# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1

# Database Configuration
DATABASE_NAME=SmartQuizDB
DATABASE_HOST=localhost
DATABASE_PORT=1433
DATABASE_USER=your_username
DATABASE_PASSWORD=your_password

# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=your_email@gmail.com
EMAIL_HOST_PASSWORD=your_app_password
DEFAULT_FROM_EMAIL=Smart Quiz System <noreply@smartquiz.com>

# Redis Configuration (optional)
REDIS_URL=redis://localhost:6379/0

# Application Settings
QUIZ_MAX_DURATION=180
PROCTORING_ENABLED=True
EMAIL_NOTIFICATIONS_ENABLED=True

Quiz System Settings

QUIZ_SETTINGS = {
    'MAX_QUIZ_DURATION': 180,        # Maximum quiz duration (minutes)
    'MAX_QUESTIONS_PER_QUIZ': 100,   # Maximum questions per quiz
    'MAX_CHOICES_PER_QUESTION': 6,   # Maximum choices per MCQ
    'DEFAULT_PASSING_SCORE': 60,     # Default passing percentage
    'MAX_ATTEMPTS_PER_QUIZ': 3,      # Maximum attempts allowed
    'PROCTORING_ENABLED': True,      # Enable proctoring features
    'EMAIL_NOTIFICATIONS_ENABLED': True,  # Enable email notifications
}

👥 User Roles & Permissions

Administrator

  • Complete system management
  • User approval and management
  • Organization and subscription management
  • System analytics and reporting
  • Security and compliance oversight

Instructor

  • Quiz creation and management
  • Question bank development
  • Student group management
  • Grade management and review
  • Analytics for their courses

Student

  • Quiz participation
  • Results viewing and analysis
  • Group participation
  • Self-assessment tools
  • Progress tracking

🎮 Usage Examples

Creating a Quiz (Instructor)

// Example quiz creation payload
const quizData = {
  title: "Advanced JavaScript Concepts",
  description: "Test your knowledge of ES6+ features",
  duration_minutes: 60,
  passing_score: 70,
  quiz_type: "assessment",
  visibility: "group",
  group_id: 123,
  questions: [
    {
      question_text: "What is the purpose of async/await?",
      question_type: "multiple_choice",
      marks: 2,
      choices: [
        { choice_text: "Handle asynchronous operations", is_correct: true },
        { choice_text: "Create synchronous code", is_correct: false },
        { choice_text: "Handle errors only", is_correct: false },
        { choice_text: "Improve performance", is_correct: false }
      ]
    }
  ]
};

Taking a Quiz (Student)

// Start quiz attempt
const attempt = await api.post('/api/quizzes/attempts/', {
  quiz_id: 123
});

// Submit answers
const submission = await api.post(`/api/quizzes/attempts/${attempt.id}/submit/`, {
  answers: [
    { question_id: 1, selected_choices: [1] },
    { question_id: 2, text_answer: "Event loop manages async operations" }
  ]
});

📊 API Documentation

Authentication Endpoints

POST /api/auth/register/          # User registration
POST /api/auth/login/             # User login
POST /api/auth/logout/            # User logout
GET  /api/auth/profile/           # Get user profile
POST /api/auth/refresh/           # Refresh JWT token

Quiz Management

GET    /api/quizzes/                    # List quizzes
POST   /api/quizzes/                    # Create quiz
GET    /api/quizzes/{id}/               # Get quiz details
PUT    /api/quizzes/{id}/               # Update quiz
DELETE /api/quizzes/{id}/               # Delete quiz
POST   /api/quizzes/{id}/attempts/      # Start quiz attempt

Results & Analytics

GET /api/results/my-results/            # Student's quiz results
GET /api/results/quiz/{id}/analytics/   # Quiz analytics
GET /api/admin/dashboard/stats/         # Admin dashboard stats
GET /api/admin/users/                   # User management

🧪 Testing

Backend Tests

cd backend

# Run all tests
python manage.py test

# Run with coverage
pip install coverage
coverage run --source='.' manage.py test
coverage report

Frontend Tests

cd frontend

# Run tests
npm test

# Run with coverage
npm test -- --coverage --watchAll=false

End-to-End Tests

# Install Cypress
npm install cypress --save-dev

# Run E2E tests
npx cypress run

🚀 Deployment

Development

# Start all services
docker-compose up -d

# Or start individually
python backend/manage.py runserver    # Backend
npm start --prefix frontend          # Frontend

Production

# Build and deploy
docker-compose -f docker-compose.prod.yml up -d

# Or follow the comprehensive deployment guide
# See docs/PRODUCTION_DEPLOYMENT.md

🔒 Security Features

  • JWT Authentication with refresh tokens
  • Role-based access control (RBAC)
  • CSRF Protection for all forms
  • XSS Prevention with input sanitization
  • SQL Injection Protection with ORM
  • Secure Headers implementation
  • Rate Limiting for API endpoints
  • Password Hashing with Django's PBKDF2
  • Secure Session Management
  • Email Verification system

📈 Performance Features

  • Database Indexing for optimal query performance
  • Redis Caching for frequently accessed data
  • Background Tasks with Celery
  • Connection Pooling for database efficiency
  • Static File Optimization with WhiteNoise
  • Frontend Code Splitting with React lazy loading
  • Image Optimization and lazy loading
  • API Response Caching strategies

🌐 Browser Support

Browser Version
Chrome 88+
Firefox 85+
Safari 14+
Edge 88+

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Follow PEP 8 for Python code
  • Use ESLint configuration for JavaScript
  • Write comprehensive tests for new features
  • Update documentation for API changes

📋 Roadmap

Version 2.0 (Q4 2025)

  • Mobile applications (React Native)
  • Advanced analytics with ML insights
  • Video-based questions support
  • Blockchain-based certificate verification
  • Advanced proctoring with AI

Version 2.1 (Q1 2026)

  • Microservices architecture
  • GraphQL API support
  • Real-time collaborative features
  • Advanced accessibility features
  • Multi-language support

🐛 Known Issues

  • Quiz timer may not sync perfectly across browser tabs
  • Large file uploads may timeout on slow connections
  • Email delivery may be delayed in high-traffic scenarios

See Issues for a complete list and to report new bugs.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Support & Contact

🙏 Acknowledgments

  • Django and Django REST Framework communities
  • React and Create React App teams
  • TailwindCSS for the amazing utility framework
  • All open-source contributors who made this project possible

⭐ Star this repository if you find it helpful!

Made with ❤️ by Kawchar Ahammed

About

A comprehensive online quiz management system built with Django REST API and React. Features real-time proctoring, multi-tenant architecture, group management, and advanced analytics for educational institutions and organizations.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published