An intelligent, beginner-friendly quiz application powered by Google Gemini AI that generates unlimited quiz questions on diverse topics. Get personalized learning experiences with instant feedback and detailed explanations.
๐ quiz.obaidinfo.xyz - Primary URL
๐ kwiz.obaidinfo.xyz - Alternative URL
Both URLs point to the same application hosted on AWS S3 with CloudFront CDN for fast global access.
- ๐ฒ Random Topic Generation - AI selects from 100+ diverse topics (History, Science, Sports, Movies, Technology, and more)
- ๐ค AI-Powered Questions - Uses Google Gemini 2.5 Flash for intelligent question generation
- ๐ Real-Time Score Tracking - See your progress instantly
- ๐ก Detailed Explanations - Learn why answers are correct with educational explanations
- ๐ฑ Fully Responsive Design - Works perfectly on mobile, tablet, and desktop
- ๐ No Backend Required - Pure front-end application, works as static website
- โ๏ธ Cloud Hosted - Deployed on AWS S3 with CloudFront CDN
- ๐ Privacy Focused - API key stored locally in your browser only
- ๐พ Topic History - Tracks used topics to ensure variety in questions
- โก Fast Loading - Instant page load with optimized assets
-
Frontend:
- HTML5 (Semantic markup)
- CSS3 (Animations, Gradients, Responsive Design)
- JavaScript (Vanilla ES6+, no frameworks)
- Bootstrap 5 (UI Components)
-
AI & API:
- Google Gemini 2.5 Flash API
- JSON-based question generation
-
Hosting:
- AWS S3 (Storage)
- CloudFront CDN (Global distribution)
- Route 53 DNS (Domain management)
The app can generate quizzes on topics including but not limited to:
- History: World History, Ancient Civilizations, Modern History, Art History
- Science: Biology, Chemistry, Physics, Astronomy, Space Exploration
- Geography: World Capitals, Countries & Flags, Mountains & Rivers
- Entertainment: Movies, Cinema, Animated Films, TV Shows
- Sports: Football, Basketball, Olympics, Cricket
- Technology: AI, Programming, Computer Science, Inventions
- Culture: Music, Literature, Mythology, Languages, Art
- And 70+ more topics!
Simply visit one of the live URLs above:
- Clone the repository:
git clone https://github.com/ObaidAbdullah16/Quiz-App.git
cd Quiz-App-
Get a Free Google Gemini API Key:
- Visit Google AI Studio
- Click "Create API Key"
- Copy your API key
-
Run locally:
- Open
index.htmlin your web browser - Or use a local server:
python -m http.server 8000 # Visit http://localhost:8000 - Open
-
Start the quiz:
- Paste your Google Gemini API key
- Click "Save & Start Quiz"
- Enjoy learning!
Note: Your API key is stored only in your browser's localStorage and never shared.
1. User enters API key
โ
2. App generates random topic
โ
3. AI creates 5 multiple-choice questions
โ
4. User answers each question
โ
5. Instant feedback with correct answer highlighted
โ
6. Detailed explanation provided
โ
7. Final score displayed with motivational message
โ
8. User can start new quiz with different topic
Random Topic Selection (from 100+ topics)
โ
Google Gemini API Request
โ
AI Generates:
- Question text
- 4 Multiple choice options
- Correct answer index
- Educational explanation
โ
JSON Response Parsing
โ
Display on Screen with Animations
Quiz-App/
โโโ index.html # Main HTML structure
โ โโโ Header section with title & buttons
โ โโโ API Key input form
โ โโโ Quiz display section
โ โโโ Results section
โ โโโ Loading spinner
โ
โโโ script.js # JavaScript logic (~415 lines)
โ โโโ API Configuration
โ โโโ Global Variables & Topic List
โ โโโ DOM Element References
โ โโโ Event Listeners
โ โโโ Quiz Generation Logic
โ โโโ Question Display & Validation
โ โโโ Score Calculation
โ โโโ Topic History Management
โ โโโ Error Handling
โ
โโโ style.css # Custom styling (~163 lines)
โ โโโ Purple gradient background
โ โโโ Card & Container styling
โ โโโ Button animations & hover effects
โ โโโ Topic display styling
โ โโโ Explanation box animations
โ โโโ Loading spinner
โ โโโ Mobile responsive design
โ
โโโ README.md # This file
- Input field for Google Gemini API key
- "Save & Start Quiz" button
- Link to get free API key
- Privacy notice
- Current topic shown in alert box
- Question counter (e.g., "Question 1/5")
- Question text
- 4 Multiple-choice answer buttons (A, B, C, D)
- Real-time score display
- Correct answer highlighted in green
- Wrong answer highlighted in red
- Detailed explanation with educational content
- "Next Question" button
- Final score display
- Motivational message based on performance
- "Try Another Topic" button to restart
- "Reset Topic History" - Clear used topics
- "Show Topic History" - View topics you've seen
โ Secure:
- API key stored only in browser's localStorage
- Never transmitted to any server except Google Gemini
- No personal data collection
- No tracking or analytics
โ Local Storage:
- Used topics list saved locally
- API key persists across sessions
- User can clear all data anytime
| Component | Cost |
|---|---|
| Google Gemini API | FREE (60 requests/minute) |
| AWS S3 Storage | FREE (5GB tier) |
| CloudFront CDN | FREE (1GB/month tier) |
| Route 53 DNS | $0.50/month |
| Total Monthly Cost | ~$0.50 |
Mobile: 320px - 576px (Full width, optimized touch)
Tablet: 577px - 992px (Wide layout, comfortable spacing)
Desktop: 993px+ (Max width 800px container)- Reduced padding on small screens
- Touch-friendly button sizes
- Optimized font sizes
- Full-screen support
Press F12 to open developer tools. You'll see:
- Selected topic
- API request details
- API response data
- Error messages with solutions
"API Error: Invalid API Key"
- Check if your API key is correct
- Make sure it's for Google Gemini
- Regenerate key at Google AI Studio
"No JSON found in response"
- AI failed to generate valid JSON
- Try again - it usually works on retry
- Check browser console for details
"Network Error"
- Check internet connection
- Verify not behind restrictive firewall
- Try disabling browser extensions
Questions not appearing?
- Wait for loading spinner to complete
- Check browser console (F12)
- Clear localStorage and try again
-
Create S3 Bucket:
aws s3 mb s3://quiz-app-production
-
Upload Files:
aws s3 sync ./ s3://quiz-app-production \ --exclude "README.md" \ --exclude ".git"
-
Enable Static Website Hosting:
- S3 Console โ Properties โ Static website hosting
- Index document:
index.html - Error document:
index.html(for SPA routing)
-
Create CloudFront Distribution:
- Origin: S3 website endpoint
- Alternate domain names:
quiz.obaidinfo.xyz,kwiz.obaidinfo.xyz - SSL certificate: Your domain certificate
- Default root object:
index.html
-
Update Route 53 DNS:
Record name: quiz Type: A (Alias) Alias target: CloudFront domain Record name: kwiz Type: A (Alias) Alias target: CloudFront domain
-
Push to GitHub:
git push origin main
-
Enable GitHub Pages:
- Settings โ Pages
- Branch: main
- Deploy to
https://username.github.io/Quiz-App
- โ Extensive comments explaining logic
- โ Semantic variable names
- โ Modular functions (single responsibility)
- โ Error handling with helpful messages
- โ No external dependencies (vanilla JavaScript)
generateQuiz() // AI generates questions via Gemini API
displayQuestion() // Shows current question on screen
selectAnswer() // Handles user answer selection
nextQuestion() // Moves to next question
showResults() // Displays final score & message
getRandomUnusedTopic() // Selects new topic with variety- Page Load Time: < 1 second
- Quiz Generation: 2-3 seconds (API call)
- Answer Feedback: Instant (< 100ms)
- Overall Latency: Optimized with CDN caching
- Difficulty levels (Easy, Medium, Hard)
- Custom topic input
- Leaderboard with scoring history
- Category-based quizzes
- Timer mode (timed questions)
- Dark mode toggle
- Multiplayer quiz sessions
- Export score as PDF
- Community-shared quizzes
- Mobile app version
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch:
git checkout -b feature/YourFeature
- Make your changes:
- Add comments for complex logic
- Ensure responsive design
- Test on mobile & desktop
- Commit your changes:
git commit -m "Add YourFeature" - Push to your branch:
git push origin feature/YourFeature
- Open a Pull Request
- New UI themes
- Additional quiz topics
- Performance optimizations
- Accessibility improvements
- Bug fixes & testing
This project is licensed under the MIT License - see the LICENSE file for details.
Obaid Abdullah
- GitHub: @ObaidAbdullah16
- Portfolio: obaidinfo.xyz
- Quiz App: quiz.obaidinfo.xyz | kwiz.obaidinfo.xyz
Want to learn more about the technologies used?
- MDN - HTML Basics
- MDN - CSS Basics
- MDN - JavaScript Basics
- Bootstrap 5 Documentation
- Google Gemini API Guide
- AWS S3 Documentation
- CloudFront Documentation
None currently! If you find any bugs or have issues, please report them.
If you encounter any issues or have questions:
- ๐ฎ Open an Issue
- ๐ฌ Check Discussions
- ๐ Visit my Portfolio
- ๐ฏ Try the live app at quiz.obaidinfo.xyz
Give a โญ๏ธ if you found this project helpful!
Built with โค๏ธ using vanilla JavaScript and powered by Google Gemini AI
Last Updated: May 26, 2026