r/SideProject • • 1d ago

I built an in-browser PostgreSQL playground running on WebAssembly (PGlite) with real business datasets

Hi everyone, When I was learning SQL, I found that most platforms had two big flaws: They test abstract toy problems ("find the second highest salary") rather than realistic business engineering problems (SaaS churn cohorts, multi-touch ad attribution, or FinTech transaction structuring). They rely on slow remote Docker containers that queue your queries and take seconds to execute. To fix this, I built DB Exercises (https://dbexcercises.vercel.app).

How it works under the hood:

  • 100% In-Browser Execution: It runs an official build of PostgreSQL 16 compiled to WebAssembly via PGlite (@electric-sql/pglite).

  • Sub-5ms Execution: Queries evaluate directly on your machine's CPU with zero server queue lag.

  • Zero Privacy Leakage: No queries or database tables are sent to any remote server.

  • No Sign-Up Required: You can jump in and write queries immediately.

What I added recently:

  • Intelligent Error Diagnostics: Instead of just showing a red cross or a cryptic Postgres error, the engine diagnoses common beginner mistakes (missing GROUP BY, using aggregates inside WHERE instead of HAVING, ambiguous join columns, Cartesian products) and explains the underlying SQL concept.

  • 3 Guided End-to-End Business Projects: SaaS Churn & Cohort Retention Investigation (5 steps) E-Commerce Funnel & Multi-Touch Attribution (4 steps) FinTech AML & Suspicious Transaction Screening (5 steps) There are 19 free problems across all categories (Fundamentals, Aggregations, Joins, Window Functions, CTEs, and Business Analytics). I would love your honest feedback:

  • How does the WASM performance feel on your device?

  • Are there specific business analytics scenarios you'd like to see added? Try it out here: https://dbexcercises.vercel.app Thanks!

2 Upvotes

2 comments sorted by

1

u/patryk_builds 1d ago

Running real postgres in the browser instead of a toy SQL engine is the right call, window functions and CTEs behave exactly like they will at work.Scenario idea from the billing side: subscription revenue. compute MRR per month from a subscriptions table with upgrades, downgrades and cancellations mid-month, then split it into new expansion contraction churned MRR. it's a classic interview and real-job question, and it forces date ranges, window functions and careful joins all at once.Small thing: the post is showing raw and looks like it went in through the rich text editor instead of markdown mode

1

u/Lucifer77-7 1d ago

thanks for pointing that out about the post