An open API service indexing awesome lists of open source software.

https://github.com/kawchar-ahammed/smart-quiz-system

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.
https://github.com/kawchar-ahammed/smart-quiz-system

django educational-platform javascript jwt-authentication multi-tenant-applications online-assessment proctoring python quiz-platform quiz-system rest-api-framework self-assessment smart-quiz-system sql-server tailwindcss web-application

Last synced: 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

          

# ๐ŸŽ“ Smart Quiz System

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

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Django](https://img.shields.io/badge/Django-4.2.7-green.svg)](https://djangoproject.com/)
[![React](https://img.shields.io/badge/React-18.2.0-blue.svg)](https://reactjs.org/)
[![SQL Server](https://img.shields.io/badge/SQL%20Server-2019-red.svg)](https://www.microsoft.com/en-us/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**
```bash
# Required software
Python 3.9+
Node.js 16+
SQL Server 2019+ (or SQL Server Express)
Redis (optional, for background tasks)
```

### **1. Clone & Setup**
```bash
# 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**
```bash
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**
```bash
cd frontend

# Install dependencies
npm install

# Start development server
npm start
```

### **4. Database Configuration**
```sql
-- Execute the enhanced schema
sqlcmd -S localhost -d SmartQuizDB -i database/enhanced_schema.sql
```

### **5. Access the Application**
- **Frontend**: http://localhost:3000
- **Backend API**: http://localhost:8000
- **Admin Panel**: http://localhost:8000/admin

## ๐Ÿ“ **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:

```env
# 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

# 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**
```python
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)**
```javascript
// 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)**
```javascript
// 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**
```http
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**
```http
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**
```http
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**
```bash
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**
```bash
cd frontend

# Run tests
npm test

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

### **End-to-End Tests**
```bash
# Install Cypress
npm install cypress --save-dev

# Run E2E tests
npx cypress run
```

## ๐Ÿš€ **Deployment**

### **Development**
```bash
# Start all services
docker-compose up -d

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

### **Production**
```bash
# 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](CONTRIBUTING.md) 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](https://github.com/yourusername/smart-quiz-system/issues) for a complete list and to report new bugs.

## ๐Ÿ“„ **License**

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ“ž **Support & Contact**

- **Documentation**: [Wiki](https://github.com/yourusername/smart-quiz-system/wiki)
- **Issues**: [GitHub Issues](https://github.com/yourusername/smart-quiz-system/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/smart-quiz-system/discussions)
- **Email**: support@smartquiz.com

## ๐Ÿ™ **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](https://github.com/Kawchar-Ahammed)