Skip to content
S

StemQuest AI

Don't Just Study. Evolve

Created on 24th January 2026

S

StemQuest AI

Don't Just Study. Evolve

The problem StemQuest AI solves

StemQuest AI bridges the gap between abstract learning and real-world success. We replace boring rote memorization with immersive, gamified quests that adapt to your skill level in real-time. Whether you aspire to be an Aerospace Engineer or a Full-Stack Developer, our intelligent agents guide you through the exact skills you need, turning your education into an engaging adventure. Your journey from 'Beginner' to 'Legend' starts now.

Challenges we ran into

  1. The "Ghost" Progress Bug (Database Synchronization)
    The Problem: One of the hardest parts of gamification was keeping the data in sync. I initially tried to update the user's XP, quest status, and leaderboard ranking in three separate API calls from the frontend. This led to "race conditions" where a user would complete a quest, get the XP, but their "Quests Completed" count on the leaderboard wouldn't update because of network latency or browser closures.

How I solved it: I moved this logic entirely to the database layer using Supabase RPC (Remote Procedure Calls). I wrote a single PostgreSQL function (finish_quest) that performs an atomic transaction:

Marks the quest as completed.

Calculates and adds the XP to the profiles table.

Increments the quests_completed counter in the leaderboard table.

Checks for badge eligibility (e.g., "First Steps") and awards it instantly.

Now, it's impossible for the data to be out of sync—either everything updates, or nothing does.

  1. Taming the AI (Structuring Unstructured Data)
    The Problem: Building a "Generative Quest Engine" was tricky because LLMs (like Gemini) love to chat, but my frontend needed strict code. Early versions of the generator would return text like "Here is your quest about Mars...", which broke the game rendering engine because it expected a JSON array of objects.

How I solved it: I utilized System Prompt Engineering and forced the Gemini API into JSON Mode. I created a strict schema in the prompt instructions:

"You MUST return a valid JSON object with 'title', 'xp_reward', and an array of 'challenges'..."

I then piped this JSON output directly into a server-side parser that validates the structure before attempting to save it to the database, ensuring that no "broken" quests ever reach the user.

  1. The "Cold Start" Dilemma
    The Problem: When I first deployed the app, the database was empty. A new user would log in to a blank dashboard with no quests to play, creating a terrible first impression. I considered writing a script to seed hundreds of fake quests, but that felt static and boring.

How I solved it: I pivoted the entire architecture to be "Generation First." Instead of pre-filling the database, I built a "Command Center" UI for empty states. If a user has no quests, they are greeted with a prompt terminal to generate their first mission. This turned a bug (empty database) into a feature (infinite, personalized content creation), making the platform feel alive and responsive to the user's specific interests.

Discussion

Builders also viewed

See more projects on Devfolio