|
| 1 | +# LousyQuiz - AI Enhanced Quiz App 🧠✨ |
| 2 | + |
| 3 | +Made by [LousyBook01](https://github.com/LousyBook94). Made bcuz i forgot everything and i need to study for my exams. 📚😅 |
| 4 | + |
| 5 | +This is an interactive quiz application built with Bun 🥟, Express 🚂, TypeScript 📜, and vanilla HTML/CSS/JS 🍦. It allows users to take quizzes loaded from JSON files or (planned feature) generated by various AI models. 🤖 |
| 6 | + |
| 7 | +This is currently in like alpha stage and very buggy, i'm not good at coding 😅 |
| 8 | +Any help would be appreciated 🙏 |
| 9 | + |
| 10 | +Made with my UI design 💖 |
| 11 | + |
| 12 | +# Preview 👀 |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## Features 🌟 |
| 18 | + |
| 19 | +* **Multiple Quiz Modes:** 🔀 |
| 20 | + * **JSON File:** Load and take quizzes defined in local JSON files. 📁 |
| 21 | + * **AI Generated (Planned):** Generate quizzes on the fly using AI. 🤖 |
| 22 | + * **AI Mixed JSON (Planned):** Enhance existing JSON quizzes with AI-generated questions. 🧠+📁 |
| 23 | +* **Dynamic Quiz Loading:** Fetches available JSON quizzes from the server. 🔄 |
| 24 | +* **Interactive Quiz Interface:** 🖥️ |
| 25 | + * Displays questions one by one. 1️⃣2️⃣3️⃣ |
| 26 | + * Shuffles questions and options. 🔀 |
| 27 | + * Provides immediate visual feedback for correct/incorrect answers. ✅❌ |
| 28 | + * Shows progress via a bottom progress bar. 📊 |
| 29 | + * Confetti animation for correct answers! 🎉 |
| 30 | + * Option to restart the current quiz or exit to selection. 🔁🚪 |
| 31 | +* **Settings Panel(Not Fully Ready, Buggy):** ⚙️ |
| 32 | + * Configure API keys for various AI providers (OpenAI, Gemini, Groq, Mistral, Anthropic, OpenRouter, Custom). 🔑 |
| 33 | + * Saves API keys to a local `.env` file. 💾 |
| 34 | +* **Basic Backend(Not Fully Ready, Buggy):** 🖥️ |
| 35 | + * Serves the frontend application. 🌐 |
| 36 | + * Provides API endpoints to list quizzes, get quiz questions, validate provider API keys, and manage settings. 🛠️ |
| 37 | + * Uses `dotenv` for environment variable management (API keys). 🔐 |
| 38 | + * Includes automatic port finding if the default port (3000) is busy. 🔍 |
| 39 | + |
| 40 | +## Usage 🚀 |
| 41 | + |
| 42 | +- Download this latest release in the release page, the file is named 'latest.zip' 📦 |
| 43 | +- Extract the zip to any folder 📂 |
| 44 | +- Run the louzyquiz.exe file to start the server 🖥️ |
| 45 | +- Open the link seen in the terminal 🌐 |
| 46 | +- Select a quiz mode and enjoy! 😎 |
| 47 | + |
| 48 | +## Adding quizes 📚 |
| 49 | + |
| 50 | +- Use 'Gemini 2.5 Pro' through the Google AI Studio or any model of your choice. (Gemini is recommended as for multimodality) 🤖 |
| 51 | +- Attach the [jsonscheme.md](jsonscheme.md) and any data/book/docs/pdf of your choice 📄 |
| 52 | +- Copy the text from prompt.txt and into the model input and send. ✉️ |
| 53 | +- Copy the generated code and paste it into a file named {your name of choice}.json. 💾 |
| 54 | +- Load up the quiz, yay! 😎 |
| 55 | + |
| 56 | +## Setup 🛠️ |
| 57 | + |
| 58 | +1. **Prerequisites:** 📋 |
| 59 | + * [Bun](https://bun.sh/) installed. 🥟 |
| 60 | + * Git (for cloning). 🐙 |
| 61 | +2. **Clone the repository:** 📥 |
| 62 | + ```bash |
| 63 | + git clone https://github.com/LousyBook94/LousyQuiz.git |
| 64 | + cd LousyQuiz # Or your repository directory name |
| 65 | + ``` |
| 66 | +3. **Install dependencies:** 📦 |
| 67 | + ```bash |
| 68 | + bun install |
| 69 | + ``` |
| 70 | +4. **(Optional) Configure API Keys:** 🔑 |
| 71 | + * Create a `.env` file in the root directory. 📁 |
| 72 | + * Add your API keys in the following format: 🔐 |
| 73 | + ```dotenv |
| 74 | + OPENAI_API_KEY=sk-... |
| 75 | + GEMINI_API_KEY=AIzaSy... |
| 76 | + GROQ_API_KEY=gsk_... |
| 77 | + MISTRAL_API_KEY=... |
| 78 | + ANTHROPIC_API_KEY=sk-ant-... |
| 79 | + OPENROUTER_API_KEY=sk-or-v1-... |
| 80 | + # CUSTOM_API_KEY=... |
| 81 | + # CUSTOM_API_BASE_URL=... |
| 82 | + # CUSTOM_API_MODEL_ENDPOINT=... |
| 83 | + # CUSTOM_API_AUTH_TYPE=... |
| 84 | + # CUSTOM_API_AUTH_HEADER_NAME=... |
| 85 | + ``` |
| 86 | + * Alternatively, you can add keys via the Settings panel in the UI after starting the app. ⚙️ |
| 87 | + |
| 88 | +## Running the Application 🏃♂️ |
| 89 | + |
| 90 | +1. **Start the server:** 🖥️ |
| 91 | + ```bash |
| 92 | + bun run index.ts |
| 93 | + ``` |
| 94 | + The server will attempt to start on port 3000 and find the next available port if 3000 is in use. 🔍 |
| 95 | +2. **Open your browser:** 🌐 |
| 96 | + Navigate to `http://localhost:<port>` (where `<port>` is the port number shown in the console, usually 3000). |
| 97 | + |
| 98 | +## Building the Application 🏗️ |
| 99 | + |
| 100 | +1. **Build the application:** 🏗️ |
| 101 | + ```bash |
| 102 | + bun run build |
| 103 | + ``` |
| 104 | + This will compile the TypeScript code, copy necessary files, and create a `build` directory with the compiled executable and assets. 📂 |
| 105 | + |
| 106 | + **NOTE : This copies over all the current quizes in the '.\quiz_data' folder** |
| 107 | +2. **Run the built application:** 🏃♂️ |
| 108 | + ```bash |
| 109 | + build\lousyquiz.exe |
| 110 | + ``` |
| 111 | + |
| 112 | +## Project Structure 🏗️ |
| 113 | + |
| 114 | +* `.env`: Stores API keys (create this file). 🔑 |
| 115 | +* `index.ts`: Backend server code (Express, API endpoints). 🖥️ |
| 116 | +* `package.json`, `bun.lockb`: Project dependencies and lock file. 📦 |
| 117 | +* `tsconfig.json`: TypeScript configuration. ⚙️ |
| 118 | +* `quiz_data/`: Directory containing JSON quiz files. 📁 |
| 119 | +* `public/`: Frontend assets. 🌐 |
| 120 | + * `index.html`: Main HTML structure. 📄 |
| 121 | + * `style.css`: CSS styles. 🎨 |
| 122 | + * `script.js`: Frontend JavaScript logic. 🧠 |
| 123 | + * `vendor/`: Third-party libraries (e.g., confetti). 🎉 |
| 124 | +* `assets/`: Contains screenshots for the README (if used). 📸 |
| 125 | + |
| 126 | +## Improvements Are Welcome! 🙌 |
| 127 | + |
| 128 | +* I would be grateful if someone can fix my buggy code and improve on this 😊 |
| 129 | + |
| 130 | +## Planned Features / TODO 📝 |
| 131 | + |
| 132 | +* Implement actual AI quiz generation logic. 🤖 |
| 133 | +* Implement AI Mixed JSON quiz logic. 🧠+📁 |
| 134 | +* Implement backend logic for securely writing settings to `.env`. 🔒 |
| 135 | +* Add UI elements for selecting AI models and generation parameters. 🎛️ |
| 136 | +* Implement caching for API responses. 💾 |
| 137 | +* Implement "Misc" settings actions (delete cache, .env, quizzes). 🧹 |
| 138 | +* Add requested animations and hover effects. ✨ |
| 139 | +* Implement theme toggling. 🌓 |
| 140 | +* Add error handling and user feedback for API interactions. ⚠️ |
| 141 | +* Refactor backend API key handling for better security (e.g., encryption at rest). 🔐 |
| 142 | + |
0 commit comments