TriviaBolt is a modern, responsive trivia quiz app built with React, Redux Toolkit, and the Open Trivia Database API. Users can customize quiz settings, choose categories, difficulty levels, and question types, and test their knowledge in a fun and interactive interface.
-
🎨 Beautiful modern UI using Tailwind CSS
-
🎯 Setup page to choose:
- Username
- Question category
- Difficulty (Easy / Medium / Hard)
- Type (Multiple Choice / True-False)
- Number of questions (1–50)
-
🧠 Fetches trivia questions from the OpenTDB API
-
🕹️ Dynamic quiz gameplay experience
-
🔁 Global state management using Redux Toolkit
-
⚠️ Real-time form validation and notifications with React Toastify
- Frontend: React, Tailwind CSS
- State Management: Redux Toolkit
- HTTP Requests: Axios
- Notifications: React Toastify
- Routing: React Router
- Trivia Questions API: OpenTDB
This project uses the Open Trivia DB API to fetch quiz questions. The API is public and rate-limited, which means:
If too many users make requests in a short time, the API may return a
429 Too Many Requestserror.
To prevent this and keep the app reliable during demos or competition submissions:
✅ Category Caching:
- Categories are fetched once and stored in
localStorage.
✅ Graceful Error Handling:
- Users are shown a helpful toast message if the API fails.
- The app doesn't crash if the API is unreachable.
✅ Fallback Questions:
- A set of fallback quiz questions can be used to keep the game playable even when the API fails.
# Clone the repo
git clone https://github.com/Dev-Rodiyat/TriviaBolt.git
cd TriviaBolt
# Install dependencies
npm install
# Start the development server
npm run devThe app will run at http://localhost:5173 (or whatever your Vite/React config specifies).
src/
├── components/ # Reusable UI components (optional)
├── pages/ # Pages like Setup, Play, Results
├── redux/
│ ├── store.js # Redux store setup
│ ├── user/ # userSlice for managing username
│ └── game/ # gameSlice for quiz settings
├── App.jsx # Main app component with routes
├── main.jsx # Entry point
└── index.css # Tailwind base styles
The app uses the Open Trivia Database API. Categories are fetched from:
https://opentdb.com/api_category.php
And quiz questions are fetched using query parameters like:
https://opentdb.com/api.php?amount=10&category=9&difficulty=easy&type=multiple
If you'd like to contribute:
- Fork the repo
- Create a new branch:
git checkout -b feature-name - Make your changes and commit:
git commit -m "Add feature" - Push to the branch:
git push origin feature-name - Create a pull request
