A beautiful Terminal User Interface (TUI) quiz application that fetches questions from quizapi.io and provides an interactive quiz experience.
- 🎨 Beautiful, colorful terminal interface
- 📚 Multiple categories to choose from
- 🎚️ Three difficulty levels (Easy, Medium, Hard)
- 📊 Real-time score tracking
- 💡 Answer explanations
- ⚡ Fast and responsive
Install QuizCraft globally via npm:
npm install -g quizcraftRun QuizCraft without installing. You need to have the API key set up as described in the Setup section below.
npx quizcraftBefore using QuizCraft, you need an API key from quizapi.io (free tier available):
- Get your free API key from https://quizapi.io/clientarea/settings/token
- Create a
.envfile in your home directory or current directory:echo "QUIZ_API_KEY=your_actual_api_key_here" > .env
- Or set it as an environment variable:
export QUIZ_API_KEY=your_actual_api_key_here
Once you have your API key set up, run:
quizcraftThen follow the interactive prompts!
- Start the application - QuizCraft welcomes you and fetches available categories
- Select a category - Choose from various topics like Linux, DevOps, Programming, or select "All Categories"
- Choose difficulty - Pick Easy 🟢, Medium 🟡, Hard 🔴, or Mixed
- Select question count - Choose between 5, 10, 15, or 20 questions
- Answer questions - Use arrow keys to select your answer (A, B, C, D)
- Get instant feedback - See if you're correct and view explanations
- View results - See your final score with performance feedback
- Play again - Start a new quiz or exit
- Clone the repository:
git clone https://github.com/dnafication/quizcraft.git
cd quizcraft- Install dependencies:
npm install- Set up your API key:
cp .env.example .env
# Edit .env and add your API key- Run the application:
npm startOr use development mode with auto-reload:
npm run devquiz-cli/
├── src/
│ ├── index.js # Entry point
│ ├── api/
│ │ └── quizApi.js # API client for quizapi.io
│ ├── ui/
│ │ ├── menu.js # Main menu interface
│ │ ├── quiz.js # Quiz display logic
│ │ └── results.js # Results display
│ ├── utils/
│ │ ├── config.js # Configuration management
│ │ └── helpers.js # Helper functions
│ └── constants.js # Constants and enums
├── .env.example # Example environment variables
├── .gitignore
├── package.json
├── PLAN.md # Detailed project plan
└── README.md
- @clack/prompts - Modern CLI prompts
- chalk - Terminal string styling
- axios - HTTP client
- ora - Terminal spinner
- dotenv - Environment variable management
This application uses the quizapi.io API to fetch quiz questions. The API provides:
- Multiple categories (Linux, DevOps, Programming, Docker, Kubernetes, and more)
- Three difficulty levels (Easy, Medium, Hard)
- Detailed explanations for answers
- Multiple choice questions
- Free tier available
QUIZ_API_KEY- Your quizapi.io API key (required)DEBUG- Set totrueto enable debug logging (optional, default:false)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
ISC
- Quiz questions powered by quizapi.io
- UI inspired by modern CLI tools
Made with ❤️ and Node.js and Copilot CLI!
