Skip to content

Commit 036a700

Browse files
author
LousyBook94
committed
FIRST COMMIT !!!
0 parents  commit 036a700

File tree

18 files changed

+3734
-0
lines changed

18 files changed

+3734
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.qodo
2+
3+
# Node.js / TypeScript
4+
node_modules/
5+
dist/
6+
build/
7+
*.log
8+
.env
9+
.env.*
10+
!/.env.example

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"zencoder.enableRepoIndexing": false
3+
}

README.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
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+
![Preview](assets/welcome.png)
14+
![Preview](assets/quiz.png)
15+
![Preview](assets/finish.png)
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+

assets/finish.png

42.3 KB
Loading

assets/quiz.png

45 KB
Loading

assets/welcome.png

62.9 KB
Loading

build.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { mkdir } from 'node:fs/promises';
2+
import { existsSync } from 'node:fs';
3+
import { exec } from 'node:child_process';
4+
import { promisify } from 'node:util';
5+
6+
const execAsync = promisify(exec);
7+
8+
async function runCommand(command) {
9+
console.log(`Running: ${command}`);
10+
const { stdout, stderr } = await execAsync(command);
11+
if (stdout) console.log(stdout);
12+
if (stderr) console.error(stderr);
13+
}
14+
15+
async function build() {
16+
try {
17+
// Remove build directory if it exists and create a fresh one
18+
if (existsSync('./build')) {
19+
console.log('Removing existing build directory...');
20+
await runCommand('rmdir /S /Q build');
21+
}
22+
console.log('Creating fresh build directory...');
23+
await mkdir('./build');
24+
25+
// Compile the application
26+
console.log('Compiling application...');
27+
await runCommand('bun build --compile --target=bun-windows-x64 ./index.ts --outfile .\\build\\lousyquiz.exe');
28+
console.log('Application compiled successfully');
29+
30+
// Copy quiz_data folder
31+
console.log('Copying quiz_data folder...');
32+
await runCommand('xcopy /E /I /Y quiz_data build\\quiz_data');
33+
34+
// Copy public folder
35+
console.log('Copying public folder...');
36+
await runCommand('xcopy /E /I /Y public build\\public');
37+
38+
// Create zip file with maximum compression
39+
console.log('Creating zip file with maximum compression...');
40+
await runCommand('cd build && powershell -Command "Get-ChildItem -Exclude latest.zip | Compress-Archive -DestinationPath latest.zip -CompressionLevel Optimal -Force"');
41+
42+
console.log('Build completed successfully!');
43+
} catch (error) {
44+
console.error('Build failed:', error);
45+
process.exit(1);
46+
}
47+
}
48+
49+
build();

0 commit comments

Comments
 (0)