Skip to content

NexusQuiz, an AI-powered adaptive quiz platform. An intelligent quiz system that dynamically adjusts question difficulty using machine learning, featuring real-time performance tracking, analytics, and a modern UI. The backend is Dockerized and built with FastAPI, Firebase, and modern JavaScript.

Notifications You must be signed in to change notification settings

MuhammadUsman-Khan/Nexus-Quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  NexusQuiz - AI-Powered Adaptive Quiz Platform

NexusQuiz Python FastAPI Docker Firebase HTML5 CSS3 JavaScript Machine Learning Scikit-learn

An intelligent Quiz system that dynamically adjusts question difficulty using Machine learning. Features real-time performance adaptation, comprehensive analytics, and a stunning glassmorphism UI. The backend is Dockerized and built with FastAPI, Firebase, and modern JavaScript.


๐ŸŒŸ Key Features

๐Ÿค– AI-Powered Adaptation

  • Machine Learning Difficulty Adjustment - Logistic Regression model predicts optimal question difficulty

  • Real-time Performance Analysis - Adapts question difficulty based on user responses

  • Personalized Learning Paths - Customized quiz experience for each user

๐ŸŽฏ Smart Quiz Engine

  • Dynamic Difficulty Levels - Easy, Medium, Hard questions adjusted in real-time

  • Progress Tracking - Real-time performance metrics and analytics

  • Adaptive Scoring - Intelligent scoring system that rewards improvement

  • Auto Grading System - Instant answer evaluation and scoring

๐Ÿ’ซ Modern UI/UX

  • Glassmorphism Design - Stunning frosted glass aesthetic with particle animations

  • Responsive Interface - Beautiful design that works on all devices

  • Smooth Animations - Engaging user experience with fluid transitions

๐Ÿ”ง Advanced Features

  • Admin Dashboard - Comprehensive question bank management

  • API Integration - Automatic question import from Open Trivia DB

  • Real-time Analytics - Detailed performance insights and statistics

  • User Dashboard - Progress visualization and tracking


๐Ÿ› ๏ธ Tech Stack

Backend & AI

  • Python - Core programming language

  • FastAPI - Modern, high-performance web framework

  • Docker โ€“ Containerized backend for consistent and scalable deployment

  • Scikit-Learn - Machine learning for difficulty prediction

  • Firebase Firestore - NoSQL database for real-time data

Frontend & UI

  • Vanilla JavaScript - Interactive frontend logic

  • HTML5 & CSS3 - Responsive web design with glassmorphism effects

  • Particle Animations - Dynamic background elements

Machine Learning

  • Logistic Regression - Difficulty classification model

  • Real-time Analytics - Performance pattern recognition

  • Predictive Modeling - Skill level assessment


๐Ÿ“‚ Project Structure

Nexus-Quiz/
โ”œโ”€โ”€ quiz_engine/                 # AI & ML Components
โ”‚   โ”œโ”€โ”€ difficulty_model.py     # ML model for difficulty prediction
โ”‚   โ”œโ”€โ”€ selector.py             # Question selection logic
โ”‚   โ”œโ”€โ”€ grader.py               # Answer evaluation system
โ”‚   โ””โ”€โ”€ feedback_generator.py   # Personalized feedback generation
โ”œโ”€โ”€ backend/                    # API & Server
โ”‚   โ”œโ”€โ”€ main.py                # FastAPI application entry point
โ”‚   โ”œโ”€โ”€ models/                # Pydantic data models
โ”‚   โ”œโ”€โ”€ routes/                # API route handlers
โ”‚   โ”‚   โ”œโ”€โ”€ quiz.py           # Quiz management endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ user.py           # User authentication & management
โ”‚   โ”‚   โ”œโ”€โ”€ question.py       # Question bank operations
โ”‚   โ”‚   โ””โ”€โ”€ result.py         # Results & analytics
โ”‚   โ””โ”€โ”€ db/                    # Database configuration
โ”‚       โ””โ”€โ”€ firebase_config.py # Firebase integration
โ”œโ”€โ”€ frontend/                   # User Interface
โ”‚   โ”œโ”€โ”€ index.html            # Main application
โ”‚   โ”œโ”€โ”€ style.css             # Glassmorphism styles
โ”‚   โ””โ”€โ”€ app.js               # Frontend logic
โ”œโ”€โ”€ Dockerfile                 # Backend container definition
โ”œโ”€โ”€ docker-compose.yml         # Multi-container orchestration
โ””โ”€โ”€ requirements.txt          # Python dependencies

๐Ÿš€ Adaptive Quiz Flow

Process Overview:

  • Quiz Initialization - System assesses user's starting level based on previous performance

  • Real-time Assessment - Each answer updates skill evaluation and ML model

  • ML-Powered Adaptation - Logistic regression predicts optimal difficulty for next question

  • Progressive Challenge - Questions dynamically adapt to user capability

  • Comprehensive Evaluation - Final scoring with detailed analytics and AI-generated feedback

  • Continuous Learning - System improves from aggregated user data



๐Ÿ”ง Installation & Setup

๐Ÿณ Docker Setup (Recommended)

Prerequisites

  • Docker
  • Docker Compose

Run Backend Using Docker

docker compose up --build

Backend will be available at:

http://localhost:8000

Swagger API Docs:

http://localhost:8000/docs

Stop Containers

docker compose down

โœ… No Python, virtual environment, or manual dependency setup required

โœ… Firebase credentials are securely mounted via Docker volumes


OR


Prerequisites

  • Python 3.8 or higher

  • Firebase account and project

  • Modern web browser

Quick Start

Clone Repository

git clone https://github.com/MuhammadUsman-Khan/Nexus-Quiz.git
cd Nexus-Quiz

Install Dependencies

pip install -r requirements.txt

Configure Firebase

  • Create Firebase project at Firebase Console

  • Download serviceAccountKey.json and place in backend/db/

  • Update security rules as needed

Run Application

# Start Backend Server
cd backend
uvicorn main:app --reload --port 8000

# Start Frontend (in new terminal)
python -m http.server 3000
Access Platform

Frontend: http://localhost:3000

API Documentation: http://localhost:8000/docs

๐ŸŽฎ Usage Guide

For Students/Learners

  • Register Account - Create your personalized profile with secure authentication

  • Take Adaptive Quiz - System automatically adjusts to your skill level in real-time

  • View Real-time Progress - Watch your performance metrics update after each question

  • Receive AI Feedback - Get personalized improvement suggestions based on performance patterns

  • Track Learning Journey - Monitor progress over time with detailed analytics

For Administrators/Educators

  • Manage Question Bank - Add, edit, or import questions with metadata

  • Import from Open Trivia DB - Automatic question collection from external API

  • Monitor System Analytics - Overall platform performance and usage statistics

  • User Progress Oversight - Track individual and group learning progress


๐Ÿ”Œ API Endpoints

Quiz Management

Method      	Endpoint	                      Description
POST	  /api/quiz/start            	Initialize new adaptive quiz session
POST	  /api/quiz/submit-answer	    Evaluate answer and update user model
POST	  /api/quiz/next-question    	Get next question based on current performance
POST	  /api/quiz/end-quiz	        Finalize session and generate feedback

User Management

Method	    Endpoint	                        Description
POST	  /api/users/register	    User registration with secure authentication
POST	  /api/users/login	        User login and session management
GET	      /api/users/{email}	    Retrieve user profile and history

Question Bank

Method  	    Endpoint  	                                Description
GET	        /api/questions/all	                  Retrieve all questions (Admin only)
POST	    /api/questions/add	                  Add new question to bank
POST	    /api/questions/import-from-api	      Bulk import from Open Trivia DB
DELETE	    /api/questions/{id}	                  Remove question from bank

Analytics & Results

Method  	    Endpoint	                            Description
GET	      /api/results/user/{email}	      Get user's quiz history and progress
GET  	  /api/results/all	              System-wide analytics (Admin only)

๐Ÿค– Machine Learning Implementation

Difficulty Prediction Model

class DifficultyModel:
    def __init__(self):
        self.model = LogisticRegression()
        # Trained on user performance data
    
    def predict_difficulty(self, previous_score: float) -> str:
        prediction = self.model.predict([[previous_score]])
        return ["easy", "medium", "hard"][prediction[0]]

Adaptive Logic Features

  • Input Parameters: User performance history, current score, response time, accuracy patterns

  • ML Processing: Logistic regression with feature engineering and real-time retraining

  • Output: Optimal difficulty level ("easy", "medium", "hard") for next question

  • Continuous Learning: Model improves automatically from aggregated user data


๐ŸŽจ UI/UX Features

Glassmorphism Design

  • Frosted Glass Effects: Backdrop filters for modern aesthetic

  • Particle Animations: Dynamic floating elements in background

  • Smooth Transitions: CSS animations for engaging interactions

  • Responsive Grid: Adaptive layout for all device sizes

User Experience

  • Real-time Feedback: Immediate response after each answer

  • Progress Visualization: Clear indicators of current performance

  • Intuitive Navigation: Easy-to-use interface for all user types

๐Ÿ”’ Security Features

  • Password Hashing: PBKDF2 with HMAC-SHA256 and salt

  • Input Validation: Pydantic models for data integrity and type safety

  • CORS Protection: Configured cross-origin resource sharing

  • Firebase Security Rules: Database-level access control

  • API Authentication: Header-based user verification


๐Ÿš€ Deployment

Local Development

# Backend Development Server
uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Frontend Development Server
python -m http.server 3000

Production Deployment

  • Backend: Deploy FastAPI to cloud platforms (Heroku, DigitalOcean, AWS, GCP)

  • Frontend: Deploy static files to hosting services (Netlify, Vercel, GitHub Pages)

  • Database: Firebase Firestore (automatically scales with usage)


๐Ÿ“ˆ Future Enhancements

๐ŸŽฎ Gamification Features

  • Leaderboards - Competitive ranking system

  • Achievement Badges - Reward system for milestones

  • Points & Rewards - Engagementๆฟ€ๅŠฑๆœบๅˆถ

  • Social Features - Peer learning and competition

๐Ÿ” Advanced Analytics

  • Detailed Performance Breakdowns - Subject-wise analysis

  • Comparative Analytics - Peer performance comparison

  • Predictive Performance Modeling - Future performance forecasts

  • Learning Pattern Recognition - Study habit insights

๐Ÿค– AI Expansion

  • LLM Integration - AI-generated questions and explanations

  • Natural Language Processing - Open-ended answer evaluation

  • Advanced Recommendation System - Personalized learning paths

  • Speech Recognition - Voice-based answering

๐Ÿ“ฑ Platform Growth

  • Mobile Application - iOS and Android native apps

  • Multi-language Support - Internationalization

  • LMS Integration - Compatibility with learning management systems

  • Offline Capability - Quiz functionality without internet


License Information

This project has no license specified. All rights are reserved by the owner.

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

Fork the repository

Create a feature branch (git checkout -b feature/amazing-feature)

Commit your changes (git commit -m 'Add amazing feature')

Push to the branch (git push origin feature/amazing-feature)

Open a Pull Request

๐Ÿ‘จโ€๐Ÿ’ป Developer

Muhammad Usman Khan

GitHub: @MuhammadUsman-Khan

Project: Adaptive Quiz Platform with Machine Learning

Email: m.usman.khan.stu@gmail.com*

About

NexusQuiz, an AI-powered adaptive quiz platform. An intelligent quiz system that dynamically adjusts question difficulty using machine learning, featuring real-time performance tracking, analytics, and a modern UI. The backend is Dockerized and built with FastAPI, Firebase, and modern JavaScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published