Inspiration
Learning SQL usually means staring at sterile spreadsheets, dry documentation, and intimidating error messages. Meanwhile, retro dungeon crawlers are all about exploration, solving puzzles, and defeating monsters. For the Frankenstein category, we asked: What happens if you stitch a real relational database engine directly into the core game loop of a 16-bit fantasy RPG?
Instead of pressing arrow keys or clicking attack buttons, every monster, chest, locked door, and trap in SQL Dungeon is a live row inside an in-memory SQLite database. If you want to unlock a gate, loot a blessed chest, or banish skeleton minions, you have to write real SQL.
What it does
SQL Dungeon is a zero-backend, browser-based educational RPG that takes players from writing their very first SELECT statement to mastering advanced SQL concepts across 100 progressive levels (10 themed dungeon floors):
- Skill-Based Entry & Field Manual: Players choose their starting experience (Just Started, Beginner, or SQL Warrior) and can open an interactive "SQL & Dungeon Field Manual" that translates database concepts into RPG analogies.
- Zero-Confusion Visual Database Mapping: Hovering over any sprite in the 2D dungeon reveals its exact table name, row ID, and column stats, paired with clickable schema pills in the terminal so beginners never get stuck guessing object names.
- 3-Stage "Teach First" Hint System: Instead of spoiling the answer when a player makes a mistake, the helper first explains the concept in plain English, then shows a working example on a different scenario, and finally offers a fill-in-the-blank template.
- 100-Level Mastery Curriculum: Covers
SELECT,WHERE, wildcards (LIKE),ORDER BY, aggregations (COUNT,SUM,GROUP BY), mutations (INSERT,UPDATE,DELETE),JOINs, subqueries, CTEs (WITH), and Window Functions (ROW_NUMBER,RANK).
How we built it
- Frontend & Rendering: Built with React, TypeScript, Vite, and Tailwind CSS, using an HTML5 Canvas renderer for crisp pixel-art sprites, floating damage numbers, screen shake, and particle effects.
- Client-Side Database Engine (
sql.js): Compiled SQLite running via WebAssembly directly in the browser. Every level initializes an isolated database snapshot; executing a query mutates the live tables and triggers immediate visual state updates. - Procedural Retro Audio: Built a zero-dependency Web Audio API synthesizer (
retroAudio.ts) that generates 16-bit sound effects (sword slashes, chest chimes, door unlocks, and error buzzes) mathematically in real time.
How we used Kiro
Kiro's spec-driven workflow was essential for keeping a 100-level game architecture clean and bug-free:
- Specs (
requirements.md,design.md,tasks.md): We used Kiro to architect a strict separation between the WebAssembly SQLite engine (sqlEngine.ts), the 10-floor curriculum modules, and the React UI before writing code. - Steering Rules (
.kiro/steering/tech-standards.md): Enforced strict TypeScript (zeroanytypes), isolatedsql.jsexecution insidetry/catchblocks, and mandated zero external asset dependencies so the app works reliably offline. - Agent Hooks: Configured an automated verification hook on level files so every level's initial seed schema and target solution were validated against SQLite automatically.
Challenges we ran into
- Making SQL Accessible Without Dumbing It Down: Early playtests showed beginners got frustrated when they didn't know what a goblin or chest was called in the database. We solved this by building interactive canvas hover badges and clickable schema pills that bridge the visual world and the relational schema.
- Managing 100 Levels Cleanly: Designing 100 distinct puzzles without schema collisions required modularizing the curriculum into 10 separate floor files (
floor1.ts–floor10.ts) with clean per-level SQLite snapshot resets.
Accomplishments that we're proud of
- Stitching two completely different worlds—relational database administration and 16-bit RPG combat—into an experience that genuinely teaches SQL from scratch to mastery.
- Building a 100% client-side application (WebAssembly SQLite + Canvas + Web Audio) with zero external servers, API keys, or media assets.
What we learned
- Visual feedback transforms abstract query logic: seeing a goblin's HP bar drop to zero the instant an
UPDATEquery executes makes relational algebra intuitive. - Spec-driven development with Kiro dramatically speeds up multi-module projects by locking down data interfaces (
LevelConfig,QueryResult,Entity) upfront.
What's next for SQL Dungeon
- Custom Dungeon Builder: Let teachers and developers write custom SQL seed scripts to generate shareable dungeon rooms.
- Speedrun & Query Golf Leaderboards: Track the fewest queries and cleanest execution plans per floor.
Built With
- html5
- kiro
- react
- sql-js
- sqlite
- tailwindcss
- typescript
- web-audio-api
- webassembly