A real-time multiplayer quiz platform inspired by Kahoot, with AI-powered quiz generation from PDF notes.
- AI-Powered Quiz Generation - Upload PDF notes and automatically generate multiple-choice questions using GPT-5 Mini
- Real-time Multiplayer - Host live quiz games with WebSocket-powered real-time updates
- Kahoot-Style Gameplay - Familiar and engaging game interface with:
- Timed questions with countdown
- Colorful answer buttons (Triangle, Diamond, Circle, Square)
- Live leaderboard between questions
- Answer distribution visualization
- Podium results at the end
- Quiz Management - Create, view, edit, and organize your quizzes
- Live Game Hosting - Generate unique PINs for players to join
- Player Experience - Join games with a PIN, see results in real-time
- Responsive Design - Works on desktop, tablet, and mobile devices
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Real-time: Socket.IO Client
- State Management: React Hooks (useState, useEffect, useContext)
- Framework: FastAPI (Python 3.12+)
- Database: SQLite with SQLAlchemy ORM
- Authentication: JWT (JSON Web Tokens)
- Real-time: Socket.IO (python-socketio)
- AI: OpenAI API (GPT-5 Mini)
- PDF Processing: PyMuPDF (fitz)
- Node.js 18+ and npm
- Python 3.12+
- OpenAI API Key - Get one at https://platform.openai.com/
git clone https://github.com/yourusername/kahootit.git
cd kahootitcd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
# Add your OpenAI API key:
echo "OPENAI_API_KEY=sk-your-key-here" > .env
echo "SECRET_KEY=your-secret-key-for-jwt" >> .env
# Initialize database
python -c "from database import engine; import models; models.Base.metadata.create_all(bind=engine)"
# Start backend server
python main_api.pyBackend will run on http://localhost:8000
cd frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will run on http://localhost:3000
-
Sign Up/Login
- Go to
http://localhost:3000 - Click "Sign In" and create an account
- Go to
-
Create a Quiz
- Click "Create Kahoot"
- Upload a PDF file (lecture notes, study materials, etc.)
- Enter a quiz title
- (Optional) Specify page range and question count
- Click "Create Kahoot"
- AI will generate questions automatically!
-
Host a Live Game
- Go to "My Kahoots"
- Click on a quiz
- Click "Host Live Game"
- Share the PIN with players
-
Join as a Player
- Go to
http://localhost:3000 - Enter the game PIN
- Enter your name
- Wait for the host to start
- Go to
-
Gameplay
- Answer questions by clicking colored buttons
- Faster correct answers = more points
- View your results after each question
- See final rankings on the podium
- Lobby: See players joining in real-time
- During Game:
- Timer countdown (20 seconds per question)
- Live answer distribution
- Remaining players counter
- "Show Answer" to reveal correct answer
- "Next" to advance to leaderboard/next question
- Between Questions: Top 3 leaderboard
- End Game: Full podium with animations
kahootit/
โโโ backend/
โ โโโ main_api.py # FastAPI app & endpoints
โ โโโ models.py # Database models
โ โโโ schemas.py # Pydantic schemas
โ โโโ auth.py # JWT authentication
โ โโโ database.py # Database configuration
โ โโโ websocket_manager.py # WebSocket event handlers
โ โโโ game_service.py # Game logic & PIN generation
โ โโโ pdf_processor.py # AI quiz generation
โ โโโ requirements.txt # Python dependencies
โ โโโ .env # Environment variables (not in repo)
โ
โโโ frontend/
โ โโโ app/
โ โ โโโ page.tsx # Homepage (PIN entry)
โ โ โโโ login/ # Authentication
โ โ โโโ create-kahoot/ # Quiz creation
โ โ โโโ my-kahoots/ # Quiz library
โ โ โโโ quiz/[id]/ # Quiz detail page
โ โ โโโ host/[pin]/ # Host lobby & game control
โ โ โโโ play/[pin]/ # Player lobby, game, results
โ โโโ components/
โ โ โโโ Navbar.tsx
โ โ โโโ QuizTile.tsx
โ โ โโโ MainContentWrapper.tsx
โ โโโ context/
โ โ โโโ AuthContext.tsx # Authentication context
โ โโโ lib/
โ โ โโโ websocket.ts # WebSocket client
โ โโโ package.json
โ
โโโ .gitignore
โโโ README.md
OPENAI_API_KEY=sk-your-openai-api-key
SECRET_KEY=your-secret-key-for-jwt-signingNEXT_PUBLIC_API_BASE_URL=http://localhost:80001. HOST creates quiz from PDF โ AI generates questions
2. HOST clicks "Host Live Game" โ Receives unique PIN
3. PLAYERS enter PIN โ Join lobby
4. HOST sees players joining in real-time
5. HOST clicks "Start Game"
6. For each question:
- Players see question & 4 colored answer buttons
- 20-second timer counts down
- Players submit answers
- Host sees answer distribution in real-time
- Host clicks "Show Answer" โ Dramatic reveal
- Host clicks "Next" โ Top 3 leaderboard shown
7. After all questions โ Full podium results
8. Players see their rank & total points
POST /register- Create new userPOST /token- Login & get JWT
GET /quiz/- Get all quizzes for userGET /quiz/{quiz_id}- Get quiz detailsPOST /upload-notes/- Create quiz from PDFPUT /quiz/{quiz_id}- Update quizDELETE /quiz/{quiz_id}- Delete quiz
POST /api/game/create- Create game session (returns PIN)GET /api/game/{pin}/info- Get game infoPOST /api/game/{pin}/start- Start gamePOST /api/game/{pin}/answer- Submit player answerGET /api/game/{pin}/leaderboard- Get current leaderboardPOST /api/game/{pin}/end- End game
Client โ Server:
join_lobby- Player joins gamehost_join- Host joins gamestart_game- Host starts gameshow_question- Host shows questionsubmit_answer- Player submits answerupdate_leaderboard- Host requests leaderboardend_game- Host ends game
Server โ Client:
lobby_joined- Confirm player joinedhost_joined- Confirm host joinedplayer_joined- New player joinedplayer_left- Player leftgame_started- Game has startedquestion_shown- Question displayedplayer_answered- Player submitted answeranswer_submitted- Answer recordedleaderboard_updated- Leaderboard datagame_ended- Game finished
# Backend (if tests exist)
cd backend
pytest
# Frontend
cd frontend
npm test- Frontend uses TypeScript for type safety
- Backend uses Pydantic for data validation
- Console logs removed for production
- Error handling implemented throughout
Built with โค๏ธ using Next.js, FastAPI, and GPT-5 Mini