From scratch, at the right moment
57 lessons from MIRA, each with an example and a try on your own query, and 98 “why it works” breakdowns. Beginner mode makes your colleagues’ hints free.
Game · SQL learning · no server
A browser detective game in which clues are found with SQL queries.
You are an analyst in the police basement of Polynya, a northern town. You look for clues with queries to “Mirror”, the department’s system, and every row you find moves the story forward.
Solo project: idea, product and game design; built with AI agents.

2 December 2026, polar night. Eight-year-old Misha has not come home from music school; Dasha is waiting out in the frost for an address.
The new analyst of the digital investigations unit sits at “Mirror”: the incident log, cameras, the civil registry, the bank, the access control system — 52 tables, about 55 thousand rows.
Petty incidents add up to a story about the Siyanie company, its owner Granin, a mayoral candidate, the Shield private security firm and Irina, the analyst’s predecessor.
In the finale the sun rises at 12:58, and at 13:00 the archives are finalized. Before that you have to put the board together and send the package. Your choices and findings lead to one of five endings.
The town, the people and the events are fictional. 18+.
02 / Why it matters
For those who have never written a query, and for those who write them every day.
57 lessons from MIRA, each with an example and a try on your own query, and 98 “why it works” breakdowns. Beginner mode makes your colleagues’ hints free.
Any correct query counts. There is a bonus for an elegant single-query solution. In the debrief you can compare your query with the reference one.
MIRA recognizes text without quotes, a comma before FROM, comparing NULL with =, JOIN without ON. A typo in a table name gets “did you mean…”.
Window functions, recursion, transactions, archive snapshots. After the season comes Zero mode: no hints, no autocomplete, no card index. You study the database structure through sqlite_master.
On the desk: a card index of tables, an editor with autocomplete, the result sheet, assignments and “Comms”: the radio and the phone. Between queries come scenes with portraits and voice acting, interrogations with prompts in your earpiece, evidence cards and the accusation.
In cases No. 03–10 the morning starts with Dasha’s briefing, and before a new case Nina offers three tasks on the techniques you are weak at. You can note eight oddities in the anomaly notebook before the story even gets to them. Ten recordings from Irina’s voice recorder unlock when the right row appears in a result.
34 achievements and a debrief against the reference.
Keyboard controls and a no-animation mode. On a phone the desk turns into tabs.
Each screenshot can be opened large, including on a phone. The game itself is in Russian.







Same archive, different screen
Query, result, assignments, card index and comms are separate tabs.
Each case adds techniques to the investigation. The handbook has 75 SQL and archive concepts. Open a title to see the topics of the case.
SELECT, WHERE, comparisons, AND, ORDER BY, LIMIT
OR, IN, BETWEEN, LIKE, IS NULL, DISTINCT
aggregates, ROUND, AS, GROUP BY, HAVING
INNER JOIN, aliases, sorting by several keys
LEFT JOIN, anti-join, JOIN chains, COALESCE, NULL logic
subqueries, EXISTS, NOT IN and NULL, CASE WHEN
dates and times, strftime, julianday, self-join
WITH, UNION, EXCEPT, INTERSECT
window functions, ROW_NUMBER, RANK, LAG/LEAD
WITH RECURSIVE, running totals, window frames
snapshot comparison, string functions, group_concat, GLOB, homoglyphs
transactions, INSERT, UPDATE, DELETE, CREATE VIEW
finale: an evidence board with nine required nodes and a package that has to be sent before 13:00
Besides SQL, the handbook covers 13 pieces of “archive” knowledge: local time and UTC, OCR of Cyrillic and Latin letters, −999 instead of a temperature, KUSP numbering (the police incident register) and other quirks of departmental databases.
There is no server: the site is a static build. The world, the database, the save and query checking all run on the player’s device.
Static export: HTML, JavaScript, WASM and media. The analyst’s desk, scenes, interrogations and the evidence board share one interface.
Zustand is the single owner of state: profile, season, active case and settings. The save lives in localStorage; the database is not part of it.
Web Worker / separate thread
The result counts, not the query text. Access depends on the story: classified tables, read-only mode, writes only to the tables the case allows.
Real SQLite with Cyrillic-aware LIKE and lower and an in-game clock. Queries run separately from the interface.
Deterministic generation from a seed. Built ahead of time as a 1.9 MB gzip file, or the world is generated right in the browser.
The built world is stored in IndexedDB. If the cache is unavailable, the world can be built again.
A small save, real SQL
The case database is rebuilt from the world, the story patches and the action journal. The save keeps only what is necessary.
The player’s action journal, together with the world and the story patches, makes it possible to rebuild the case database.
The worker restarts and restores the database from the journal. The interface is never busy running SQL meanwhile.
The diagram blocks expand without JavaScript.
06 / Quality
Not only the code is tested but the player’s path too — all the way to the final board.
The season runs through the game logic in seconds. Every case’s reference queries are checked against the real world.
A Playwright bot goes through the clicks, queries, interrogations and the finale. Screenshots are taken on desktop and on a phone.
In the repository the build fails if the budget is exceeded, and case content is loaded on demand.
On every push to main and every pull request, GitHub Actions runs type checking, the linter, the tests and the build.
The figures are taken from the project’s materials, not from a fresh test run on this page.
1,316 lines, 13 character voices and a narrator. The voices were created in ElevenLabs from descriptions, without cloning real people. The radio, the phone and voicemail sound like different channels.
63 portraits of 12 characters, 17 paintings of locations and the title screen, the desk art. The images were made with AI and refined for the game.
Paintings, the narrator, the game’s music and the real interface. Two vertical clips were cut from the same material.
The video loads only after you press “Watch the trailer”.
09 / Development
The code was written with the AI agent Claude Code: about 50 thousand lines of TypeScript in the app and 28 thousand lines of tests.
The voices, portraits, location paintings and desk art were made with AI and prepared for the game.
Five business analysis artifacts based on the project’s code and documentation: the data model, the path of a query, a task as a user story, the season in numbers and a decision log. The numbers were recounted against the published version of the game; where a diagram is simplified, it says so next to it.
10.1 · ER diagram
“Mirror” has 52 tables and about 55 thousand rows. Here is the core of the model: people, incidents, vehicles, money and traces in the system. Some links rest not on keys but on matching values — a licence plate, a KUSP number, a login: the player puts those together themselves.
personsPDB
Person records · 4,301 rows
idfull_namefather_id→ personsmother_id→ personsregistrationsMIRROR
Residence registration · 2,195 rows
idperson_id→ personsaddress_id→ addressesfrom_dateaddressesMIRROR
Address directory · 900 rows
idstreethouseaptincidentsPDB
Incident log · 2,000 rows
idkusp_no≈ incident_personsreported_atvehicle_id→ vehiclesofficer_staff_id→ staffincident_personsPDB
Incident participants · 1,312 rows
idkusp_no≈ incidentsincident_id→ incidentsperson_id→ personsvehiclesMIRROR
Vehicle register · 1,400 rows
idowner_company_id→ companiesplate≈ plate_readsowner_person_id→ personsplate_readsMIRROR
Licence plate reads · 4,000 rows
idread_atplate≈ vehiclescamera_id→ camerascamerasMIRROR
Plate recognition cameras · 60 rows
idnamecompaniesMIRROR
Company register · 250 rows
idnamedirector_person_id→ personsemploymentMIRROR
Employment · 1,800 rows
idperson_id→ personscompany_id→ companiespositionaccountsMIRROR
Bank accounts · 1,300 rows
idholder_person_id→ personsholder_company_id→ companiesbankEvery account has exactly one owner field filled in: a person or an organization.
transactionsMIRROR
Bank transactions · 4,199 rows
idaccount_id→ accountstsamountstaffPDB
Police HQ staff · 150 rows
idperson_id→ personsloginbadge_id4 person_id rows find no record in persons: that is a task in case No. 04.
loginsPDB
System accounts · 169 rows
login≈ audit_logstaff_id→ staffroleaudit_logPDB
Change log · 3,800 rows
idtslogin≈ loginstable_namerow_idThe key 15 of 52 tables, each with its key columns only. Rows were counted in the built world of the published build, before story patches. Foreign keys are declared, but the database does not enforce them (PRAGMA foreign_keys = OFF).
Source: src/engine/world/schema.ts:6–9, 89–392 · src/data/schema-notes.json · src/data/handbook/c04.json:78–88
accounts.holder_person_id → persons — empty in 142 of 1,300accounts.holder_company_id → companies — empty in 1,158 of 1,300companies.director_person_id → persons — empty in 2 of 250employment.person_id → persons — empty in 55 of 1,800employment.company_id → companies — filled in all 1,800incident_persons.incident_id → incidents — filled in all 1,312incident_persons.person_id → persons — empty in 13 of 1,312incidents.officer_staff_id → staff — filled in all 2,000incidents.vehicle_id → vehicles — empty in 1,827 of 2,000logins.staff_id → staff — empty in 2 of 169persons.father_id → persons — empty in 3,059 of 4,301persons.mother_id → persons — empty in 3,059 of 4,301plate_reads.camera_id → cameras — filled in all 4,000registrations.address_id → addresses — filled in all 2,195registrations.person_id → persons — filled in all 2,195staff.person_id → persons — 4 rows with no match in personstransactions.account_id → accounts — filled in all 4,199vehicles.owner_company_id → companies — empty in 1,249 of 1,400vehicles.owner_person_id → persons — empty in 157 of 1,400plate_reads.plate ≈ vehicles.plate — by value, no key: the licence plate; an exact match for 3,879 of 4,000 readsincident_persons.kusp_no ≈ incidents.kusp_no — by value, no key: the KUSP number; for all 1,312 participants it matches the KUSP of their incidentaudit_log.login ≈ logins.login — by value, no key: the login of whoever made the change; all 3,800 log rows have it in loginsaddresses — Address directory; MIRROR; 900 rows, 5 columnsaccounts — Bank accounts; MIRROR; 1,300 rows, 6 columnstransactions — Bank transactions; MIRROR; 4,199 rows, 8 columns, horizon on tsregistrations — Residence registration; MIRROR; 2,195 rows, 5 columnspersons — Person records; PDB; 4,301 rows, 13 columnsemployment — Employment; MIRROR; 1,800 rows, 6 columnscompanies — Company register; MIRROR; 250 rows, 7 columnsstaff — Police HQ staff; PDB; 150 rows, 12 columnsincident_persons — Incident participants; PDB; 1,312 rows, 6 columnsvehicles — Vehicle register; MIRROR; 1,400 rows, 12 columnsplate_reads — Licence plate reads; MIRROR; 4,000 rows, 6 columns, horizon on read_atlogins — System accounts; PDB; 169 rows, 7 columnsincidents — Incident log; PDB; 2,000 rows, 13 columns, horizon on reported_ataudit_log — Change log; PDB; 3,800 rows, 10 columns, horizon on tscameras — Plate recognition cameras; MIRROR; 60 rows, 5 columns10.2 · Process · BPMN
What happens after you run a query: access rights, the in-game clock, execution, result checking and the log. Four lanes: the player, the desk, the engine in a separate thread, and SQLite. The row in the query log is written last, so reference queries and secrets do not see the current query.
Simplified: left out are practice queries (the morning briefing, lessons and Nina’s review bypass the clock and the journal), the final board, the “watchman” of case No. 09 and the query quota. In browsers without Worker or IndexedDB the engine runs on the main thread, with no timeout.
Source: src/engine/runtime/session.ts:6–10, 321–414 · src/engine/runtime/client.ts:44, 362–385 · docs/design/TECH_SPEC.md:136–140 · src/engine/validator.ts:367–416
query_log (next: step 11).ATTACH, PRAGMA (except reading the structure: table_info, table_xinfo, foreign_key_list), the main. and temp. qualifiers: “FORBIDDEN”. The query does not run, the clock stands still (next: step 10).query_log, last, so that reference queries and secrets do not see it.10.3 · Requirements · user story
Case No. 03, the Taiga’s route. The story, the expected result and seven acceptance scenarios: three correct queries and four typical mistakes, with what the player sees in response.
o3_2 · Case No. 03 “Hit-and-Run on Polyarnaya”concept: table aliases
plate_reads and cameras tables are accessible.Reference solutionAC1
SELECT r.read_at, c.name, r.direction FROM plate_reads r JOIN cameras c ON c.id = r.camera_id WHERE r.plate = 'К404ТО' AND r.read_at BETWEEN '2026-11-18 22:00:00' AND '2026-11-18 23:59:59' ORDER BY r.read_at;
Different text, same answerAC2
LIKE instead of BETWEEN.SELECT plate_reads.read_at, cameras.name FROM plate_reads JOIN cameras ON cameras.id = plate_reads.camera_id WHERE plate_reads.plate = 'К404ТО' AND plate_reads.read_at LIKE '2026-11-18%' ORDER BY plate_reads.read_at;
Own names and an extra columnAC3
direction is added.SELECT c.name AS camera, r.read_at AS at, r.direction FROM cameras c JOIN plate_reads r ON r.camera_id = c.id WHERE r.plate = 'К404ТО' AND r.read_at < '2026-11-19 00:00:00' ORDER BY r.read_at ASC;
False trail: the next nightAC4
SELECT r.read_at, c.name FROM plate_reads r JOIN cameras c ON c.id = r.camera_id WHERE r.plate = 'К404ТО' no time filter ORDER BY r.read_at;19.11 at 03:10 is already the next night. You only need the evening of 18.11, until midnight.This is exactly “Irina’s cheat sheet with one mistake” from the fourth hint.
Wrong orderAC5
SELECT r.read_at, c.name FROM plate_reads r JOIN cameras c ON c.id = r.camera_id WHERE r.plate = 'К404ТО' AND r.read_at BETWEEN '2026-11-18 22:00:00' AND '2026-11-18 23:59:59' ORDER BY c.name;
The rows are right, but the order is wrong. Check ORDER BY.
No camera namesAC6
SELECT r.read_at, r.camera_id FROM plate_reads r WHERE r.plate = 'К404ТО' AND r.read_at BETWEEN '2026-11-18 22:00:00' AND '2026-11-18 23:59:59' ORDER BY r.read_at;
The “name” column is missing (or its values do not match).
Latin letters in the plateAC7
K404TO looks no different from К404ТО, but its K, T and O are Latin, not Cyrillic.SELECT r.read_at, c.name FROM plate_reads r JOIN cameras c ON c.id = r.camera_id WHERE r.plate = 'K404TO' AND r.read_at BETWEEN '2026-11-18 22:00:00' AND '2026-11-18 23:59:59' ORDER BY r.read_at;
Fewer rows than needed. Perhaps the filter is too strict.
The season has 98 tasks: each has a reference solution, 67 have a compound rule, and 20 have a negative criterion, as here.
The “user” is the player’s role in the game: this is how an in-game task is worded, not an interview with a client. All seven scenarios were run against the world of the published version; the messages are the validator’s own words (translated here), and on the assignment card they follow “Not accepted:”.
Source: src/data/cases/case-03-polyarnaya/case.json:113–163, 442–501 · src/__tests__/cases/c03.test.ts:89–92, 128–137 · src/engine/validator.ts:276–284, 367–423
10.4 · Data · chart
How many new handbook concepts each case brings and how many tables are open in it: from 3 in the prologue to 52 in the finale. Case No. 06 adds the most new tables, seven at once.
The 13 cases of the published version. A concept is credited to the case in whose handbook it first appears. Tables exclude the three archive views arch16_* (from case No. 10), which is why the finale has 52 names, not 55.
Source: src/data/cases/*/case.json (concepts, tables, objectives) · src/data/handbook/c00–c12.json
| Case | SQL | Archive | Tables | Tasks: main + side |
|---|---|---|---|---|
| Prologue “Floor Zero” | 7 | 1 | 3 | 5 + 1 |
| Case No. 01 “Copper” | 6 | 1 | 6 | 4 + 1 |
| Case No. 02 “Minus Forty-One” | 6 | 1 | 10 | 6 + 3 |
| Case No. 03 “Hit-and-Run on Polyarnaya” | 3 | 1 | 14 | 5 + 2 |
| Case No. 04 “Dead Soul” | 6 | 2 | 19 | 5 + 2 |
| Case No. 05 “Number 3312” | 6 | 1 | 22 | 5 + 2 |
| Case No. 06 “Polynya” | 6 | 1 | 29 | 5 + 4 |
| Case No. 07 “The Service Apartment” | 4 | 0 | 33 | 6 + 1 |
| Case No. 08 “Ghost in the System” | 3 | 1 | 38 | 7 + 3 |
| Case No. 09 “Matryoshka” | 4 | 1 | 44 | 5 + 2 |
| Case No. 10 “Carbon Copy” | 6 | 2 | 47 | 7 + 2 |
| Interlude “Draft” | 5 | 1 | 50 | 5 + 0 |
| Case No. 11 “First Sun” | 0 | 0 | 52 | 6 + 4 |
| Total | 62 | 13 | 52 | 71 + 27 |
10.5 · Decision log · ADR
Four rules from the project’s documentation and code: context, decision and consequence. No alternatives are given, because the documents have none.
A common mistake gives an almost correct result with one extra row, for example a read from the next night.
DecisionA not rule with its own message: the false-trail value must not be in the result. A compound rule answers with the message of the first check that fails, so in task o3_2 not comes first: the player reads its message rather than the generic “More rows than needed”.
ConsequenceThe player sees on the assignment card exactly what is wrong, not a generic “doesn’t match”. 20 of the season’s 98 tasks have a negative criterion.
Source: docs/design/TECH_SPEC.md:88 · src/engine/validator.ts:276–284, 418–423 · src/data/cases/case-03-polyarnaya/case.json:117–133
The schema should read like a real departmental database, and the “dirt” in the data should teach.
DecisionREFERENCES is in the DDL for the schema panel, but the world is built with PRAGMA foreign_keys = OFF.
ConsequenceFour staff.person_id rows find no record in persons: the first task of case No. 04 is built on this (LEFT JOIN … IS NULL).
Source: src/engine/world/schema.ts:6–9 · docs/design/GAME_DESIGN.md:1607
The season runs from 2 December to 11 January, yet there is one world for all the cases: rows for later events are already in the database.
Decision18 tables have a horizon column. Each open one gets a TEMP VIEW with the same name: rows later than the game clock are hidden. A query that runs moves the clock by the case’s rules: never past the ceiling, and in places with stops.
ConsequenceIndexes keep working. The horizon cannot be bypassed: the main. and temp. qualifiers, ATTACH and PRAGMA (except reading the structure: table_info and the like) are forbidden by the access policy.
Source: docs/design/GAME_DESIGN.md:1443 · src/engine/world/horizon.ts:64–68 · src/engine/live.ts:94–116 · src/engine/table-guard.ts:1–12
The player writes up the case conclusion as a protocol with blanks, so the answer options could simply be tried one by one.
DecisionAn option is available only if it has appeared in the player’s query results. The check confirms the blanks only when at least three are correct (two in the prologue) or all the remaining ones are correct, and it does not say which ones are wrong.
ConsequenceYou can only accuse someone you found yourself; guessing does not work. Every blank’s answer must appear in the results of the case’s reference queries, and the tests check this.
Source: src/engine/protocol.ts:6–13, 299–338 · docs/design/TECH_SPEC.md:91
Sources: the project’s code, technical specification and design document. The acceptance scenarios were run against the world of the published version of the game.
In the margins / Try it
2 December 2026. Misha has not come home from music school; Dasha is waiting out in the frost for an address. Here are 22 entries from the game’s incident log (the data is in Russian, as in the game); a real SQLite starts only when you tell it to.
Table incidents — the incident log.
id — record numberkusp_no — KUSP numberreported_at — time reportedkind — typedistrict — districtaddress_text — addressdescription — what happened
The query runs only on your device: SQLite is compiled to WebAssembly, just as in the game itself. Nothing is sent anywhere.
Next: the whole season in “Mirror”.
Play in browser