Skip to content

dnafication/quizcraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuizCraft 🎯

A beautiful Terminal User Interface (TUI) quiz application that fetches questions from quizapi.io and provides an interactive quiz experience.

screenshot of the application

Features

  • 🎨 Beautiful, colorful terminal interface
  • 📚 Multiple categories to choose from
  • 🎚️ Three difficulty levels (Easy, Medium, Hard)
  • 📊 Real-time score tracking
  • 💡 Answer explanations
  • ⚡ Fast and responsive

Installation

Global Installation (Recommended)

Install QuizCraft globally via npm:

npm install -g quizcraft

Using npx (No Installation)

Run QuizCraft without installing. You need to have the API key set up as described in the Setup section below.

npx quizcraft

Setup

Before using QuizCraft, you need an API key from quizapi.io (free tier available):

  1. Get your free API key from https://quizapi.io/clientarea/settings/token
  2. Create a .env file in your home directory or current directory:
    echo "QUIZ_API_KEY=your_actual_api_key_here" > .env
  3. Or set it as an environment variable:
    export QUIZ_API_KEY=your_actual_api_key_here

Usage

Once you have your API key set up, run:

quizcraft

Then follow the interactive prompts!

How It Works

  1. Start the application - QuizCraft welcomes you and fetches available categories
  2. Select a category - Choose from various topics like Linux, DevOps, Programming, or select "All Categories"
  3. Choose difficulty - Pick Easy 🟢, Medium 🟡, Hard 🔴, or Mixed
  4. Select question count - Choose between 5, 10, 15, or 20 questions
  5. Answer questions - Use arrow keys to select your answer (A, B, C, D)
  6. Get instant feedback - See if you're correct and view explanations
  7. View results - See your final score with performance feedback
  8. Play again - Start a new quiz or exit

Development

Running from Source

  1. Clone the repository:
git clone https://github.com/dnafication/quizcraft.git
cd quizcraft
  1. Install dependencies:
npm install
  1. Set up your API key:
cp .env.example .env
# Edit .env and add your API key
  1. Run the application:
npm start

Or use development mode with auto-reload:

npm run dev

Project Structure

quiz-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

Technologies Used

API Information

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

Environment Variables

  • QUIZ_API_KEY - Your quizapi.io API key (required)
  • DEBUG - Set to true to enable debug logging (optional, default: false)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

ISC

Acknowledgments

  • Quiz questions powered by quizapi.io
  • UI inspired by modern CLI tools

Made with ❤️ and Node.js and Copilot CLI!

About

A TUI quiz app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •