Mind-Quest: The Quiz Builder That Makes AI Behave Like a Backend Feature

Inside a teacher-first LMS workflow that turns raw model output into structured questions, auto-grades them, and feeds student mistakes back into analytics.

8 min read • View on GitHub • More from kushwahaharsh

A wide editorial scene shows a teacher at a desk with a blank quiz sheet beside a locked schema box. A stream of loose text moves into the box and emerges as question cards, option cards, and a scorecard. The image explains the core idea of the project: the model drafts, but the application decides what becomes real data.
AI is useful here only after it is forced through a structure the app can trust.
Key Takeaways

AI, but only inside the lines

Most AI quiz tools stop at generation. Mind-Quest does the harder thing: it confines generation to a schema the rest of the app can rely on. That changes the role of the model from author to draft engine.

The implementation pattern is straightforward and smart. A system prompt asks Gemini for JSON, then the backend strips common code-fence noise before parsing. The model can wander a little. The application does not.

The real product is not quiz generation. It is the loop from prompt to insight.

A teacher can draft, edit, and ship without prompt engineering

The frontend workflow is deliberately humane. In CreateQuiz.js, a teacher can write questions manually or ask AI to pre-fill the form, then edit the result before publishing. That matters because it keeps human judgment in the loop at the exact point where most AI tools try to remove it.

This is the difference between a generator and a collaborator. The teacher is not forced to trust the first answer. They can inspect it, fix it, and ship only what survives review.

What the backend is actually doing

The backend looks like a clean MERN-style split. Express controllers handle the quiz and result logic, Mongoose models define the data shape, JWT protects sessions, and role checks keep student and teacher permissions separate. The AI service sits off to the side as one module, not as the whole architecture.

// aiService.js: request raw JSON, then clean common fence noise
const response = await model.generateContent(prompt);
let text = response.response.text();
text = text.replace(/```json/g, '').replace(/```/g, '');
const parsed = JSON.parse(text);

That cleanup step is small but revealing. It acknowledges the messy reality of LLMs and treats resilience as part of product design, not an afterthought.

The smartest part is the conversion from text to structure

A close-up scene shows a page of messy JSON being scrubbed clean of stray backticks before snapping into a nested set of quiz objects. One hand holds the loose draft while another inserts the cleaned version into a strict form. The image explains how the app turns text into durable database records.
The key move is not generation. It is translation into application data.

The most interesting code path is the one that takes flat AI output and turns it into nested quiz data. That is where the system stops being a text tool and starts acting like an application.

const formattedQuestions = aiQuestions.map((q) => ({
  text: q.question,
  options: q.options.map((opt) => ({
    text: opt,
    isCorrect: opt === q.correctAnswer,
  })),
}));

This is the heart of the repo. The model can brainstorm, but only the app decides what becomes a question, what becomes an option, and what gets marked correct.

Scoring is not just scoring

The result controller does more than total correct answers. It persists detailed answers, which means the system can later show students what they missed and let teachers inspect patterns without recomputing the whole grading flow.

That design choice is easy to miss and easy to undervalue. Stored explanations turn grading into a reusable data asset.

Teachers do not just get quizzes. They get diagnosis

ModeControlSpeedReliabilityEditabilityTeacher confidence
Manual LMS authoringHighLowHighHighHigh
Prompt-first AI quiz generatorLowHighMediumLowLow
Mind-Quest hybrid workflowHighHighHighHighHigh