Learning SQL is more engaging when practice is tied to a concrete investigation instead of isolated drills.
My approach
Build a short, account-free mystery game inspired by SQL Murder Mystery: players investigate one hotel theft across five levels by querying real evidence tables through a locked-down API.
The solution
A monochrome mystery game that progresses through five levels of a hotel-theft case while players write real SQL against case tables and track findings in a Detective Notebook.
Key features
Black-and-white investigation UI for a focused mystery-game feel.
Five-level case progression from introduction through investigation to completion.
Persistent Detective Notebook for notes and pinnable query-result evidence (browser local storage).
Backend accepts only a single read-only SELECT, runs it with a restricted database role, and compares results to a hidden expected query.
Technical decisions
React + TypeScript + Vite for the investigation workspace.
Java 21 and Spring Boot for challenge loading and SQL execution.
PostgreSQL with Flyway for schema and case data; player queries use a read-only role.
Architecture
01
React UI
Loads challenges from the API, sends SQL to an execute endpoint, and keeps notebook notes plus pinned evidence in local storage.
React
TypeScript
Vite
02
Spring Boot API
Serves challenges and validates player SQL as a single read-only SELECT before execution.
Java 21
Spring Boot
03
PostgreSQL
Stores case data with Flyway migrations; player queries run under a restricted read-only database role.
PostgreSQL
Flyway
04
Investigation progression
Routes move from landing → case introduction → investigation workspace → case completion across five levels.
Outcome
Delivers a complete investigation loop — landing, case intro, workspace with SQL execution and feedback, Detective Notebook, and case completion — without exposing write access to the database.
Lessons learned
Restrict player SQL to a single read-only SELECT and a dedicated database role.
Keep notebook state client-side when the game does not require accounts.
Compare query results to a hidden expected query to grade progress without revealing the answer SQL.