A web app that generates programming multiple-choice questions using an AI backend (Groq API & Llama 3 model). Built with a FastAPI backend and a React frontend.
Features
Generates coding questions at various difficulty levels using a generative AI model.
Provides a multiple-choice interface for users.
Displays explanations for each answer.
Modern UI built with React.
FastAPI backend with CORS enabled.
Tech Stack Backend: FastAPI (Python), Groq API (for AI model), dotenv (for config)
Frontend: React (with functional components and hooks), CSS
Other: CORS Middleware, JSON API
Setup Instructions
- Backend Prerequisites Python 3.8+
Groq API access (get your API key)
Install dependencies bash pip install fastapi groq python-dotenv uvicorn Set up environment Create a .env file in the backend directory:
text
GROK_API_KEY=your_api_key_here
Run the server
bash
uvicorn main:app --reload
This will start the backend at http://localhost:8000.
- Frontend Prerequisites Node.js 16+
npm or yarn
Install dependencies bash npm install Start the React app bash npm start By default, the React frontend runs on http://localhost:3000.
Usage
Open the frontend in your browser.
Click "Generate New Question" to get a coding MCQ generated by the AI.
Select your answer and view the explanation.
Project Structure
text
backend/
main.py
.env
frontend/
App.jsx
main.jsx
App.css
Notes
Edit the system prompt in main.py to tweak the style/difficulty of generated questions.
This is a basic demo app. Feel free to extend it for your needs!
License MIT