July 5, 2026 · 2 min read
How I Built the SQL Playground
Running a real SQLite database entirely in the browser, seeded with my own portfolio data, using sql.js and WebAssembly — no backend required.
One of the things I wanted on this site was a way to actually prove I know SQL, rather than just listing it as a skill. A certificate badge is fine, but it doesn't let anyone see me write a query. So I built a small playground where visitors can run real SQL against a real database, right in the browser.
Why client-side, not a backend
The easy version of this feature would spin up a Postgres instance somewhere and expose a query endpoint. I didn't want that for a few reasons: it costs money to host, it's a security headache (arbitrary SQL from strangers hitting my database — no thanks), and it adds latency for something that should feel instant.
Instead I used sql.js — SQLite compiled to WebAssembly. It runs the entire database engine inside the visitor's own browser tab. No server round-trip, no cost, and since each visitor gets their own isolated in-memory database, there's no way for one person's queries to affect anyone else's.
Getting the WASM file to actually load
The one non-obvious setup step: sql.js needs to fetch a .wasm binary at runtime, and that file has to be served as a static asset. I copied it from node_modules/sql.js/dist/sql-wasm.wasm straight into my public/ folder, then pointed initSqlJs at it:
const SQL = await initSqlJs({
locateFile: (file) => `/${file}`,
});
Miss this step and you get a cryptic fetch failure with no useful error message — cost me a bit of debugging the first time.
Making it actually about me
The obvious dataset to seed would've been something generic — employees, orders, the usual tutorial tables. Instead I seeded it with my own portfolio data: a projects table, a certificates table, a hackathons table, all populated with my real projects and results. So when someone runs:
SELECT name, result FROM hackathons;
They're not querying fake data — they're querying an actual database that describes what I've built. It's a small thing, but it turns a generic "here's a SQL demo" into something that's actually part of my story.
What's next
Right now it's read-only against a fixed seed. Down the line I'd like to let visitors define their own schema too — but that opens up more edge cases (malformed SQL crashing the tab, infinite loops in recursive queries) that need proper guardrails before I'd ship it.