A simple full-stack web application for primary school math teachers to generate AI-powered exam papers. Teachers can specify a math topic and number of questions, and the app generates an exam using the Gemini AI API.
-
Generate math exam papers for primary school students
-
Input topic and number of questions
-
Powered by Google Gemini AI
-
Loading state with spinner while generating
-
Error handling (e.g., "Failed to generate exam. Please try again.")
-
Modern & responsive UI with Tailwind CSS
-
Input validation (no empty fields or invalid values)
-
Option to generate answer key
-
Copy exam paper to clipboard
-
Frontend: React + Tailwind CSS
-
Backend: Node.js + Express
-
AI Integration: Google Gemini API
git clone https://github.com/ashankgupta/maths-exam-generator.git
cd maths-exam-generator
cd backend
npm install
- Create a .env file inside backend/ and add:
GEMINI_API_KEY=your_api_key_here
- Start backend:
npm start
cd frontend
npm install
- Start frontend:
npm start
The frontend will run on http://localhost:3000 and backend on http://localhost:5000
ai-exam-generator/
├── backend/
│ ├── server.js
│ ├── routes/
│ │ └── exam.js
│ ├── package.json
│ ├── package-lock.json
│ └── .env
├── demo.gif
├── frontend/
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── index.css
│ └── index.js
│ ├── package.json
│ ├── package-lock.json
│
└── README.md
-
Enter a math topic (e.g., "Fractions", "Addition").
-
Enter the number of questions (numeric only).
-
(Optional) Tick checkbox to include answer key.
-
Click Generate Exam.
-
Copy generated exam with one click.
-
API key is stored securely in the backend (.env).
-
Frontend never exposes sensitive keys.
This project is licensed under the MIT License.
