Inspiration
Most quiz apps either recycle a static bank of pre-written questions or generate generic ones that have nothing to do with what a student is actually studying. As a student myself, I know the moment: you've just read a chapter, you want to test yourself on it, and every quiz tool either doesn't cover your material or feels disconnected from what's on the page in front of you. I wanted to build something that could take any textbook chapter and turn it into an infinite, adaptive quiz — grounded in the actual text, not hallucinated facts.
What it does
The app takes a chapter of text (or just a topic, if no material is uploaded) and generates original multiple-choice questions in real time using Groq's llama-3.3-70b model. It runs in two modes:
- Grounded mode: when a chapter excerpt is provided, questions are built strictly from that text, and explanations cite what the excerpt actually says — no outside facts introduced.
- Generic mode: when there's no uploaded material, it can still generate questions for any topic, grade level, and difficulty.
It also tracks recent mistakes and leans new questions toward reinforcing those weak spots, so it behaves more like spaced repetition than a static quiz bank. Difficulty is graded meaningfully: easy means the answer is directly stated in the text, medium requires connecting two ideas, and hard means applying a concept to a new situation — not just harder wording of the same question.
How we built it
The backend is a Next.js API route that accepts a topic/difficulty (and optionally a chapter excerpt and subtopic), builds a system prompt depending on whether the request is grounded or generic, and calls the Groq API with response_format: json_object to force clean, parseable output. Each generated question is validated and returned in a consistent shape (stem, choices, correctIndex, explanation) so the frontend can render it without extra parsing logic. If the Groq call fails or no API key is configured, the app falls back to a pre-written seed question bank so the user never hits a dead end.
Challenges we ran into
Getting the model to reliably return valid JSON with no markdown fences or extra commentary took some prompt iteration. We also had to handle malformed request bodies and API failures gracefully — rather than letting the whole request 500 out, we added fallback logic at every failure point (bad JSON, missing key, failed generation) so the user always gets a question, even in the worst case. Balancing the "grounded" prompt so the model doesn't drift outside the excerpt, while still producing plausible wrong answers, also took some tuning of the system prompt rules.
Built With
- groq
- llama-3.3-70b
- next.js
- node.js
- react
- rest-api
- typescript

Log in or sign up for Devpost to join the conversation.