PGPlayground is the product of copious amounts of wasted productive hours that came from constantly setting up and tearing down postgres containers in order to debug, test or design schemas.
The pain of having to:
Litter your home with bespoke directories made for temporary use and then cleaning up docker containers and volumes to recover space. It's tedious at best, infuriating at worst.
npm installnpm run dev -- --opennpm run checknpm testnpm run buildsrc/routes/ - Pages. / is the mobile landing, /playground is the main app, /about and /faq are info pages.src/lib/components/app/ - Playground UI (header, dialogs, editor, file tree, results, onboarding).src/lib/components/ui/ - Reusable UI primitives (buttons, dialogs, dropdowns, tooltips, etc.).src/lib/services/ - Data and logic:pglite.svelte.ts manages database instances, storage, migrations, and schema refresh.schema.ts builds the schema tree and catalog snapshot.samples.ts provisions sample databases and sets starter scratchpad SQL.workspace.ts handles scratchpads, tabs, and query execution state.services/sql-language/ holds the SQL grammar, parser, and completion engine.src/lib/config/ - App constants (version, links, sample definitions, defaults).static/ - Public assets including banner.png and sample SQL files under static/samples/.mainDb in pglite.svelte.ts creates and loads PGlite instances, enables extensions, and keeps schema/catalog state. Queries go through a proxied client that triggers a debounced schema refresh.workspace.ts. resetWorkspaceScratchpad rebuilds the workspace when a sample loads or when starting fresh.config/samples.ts with SQL files in static/samples/. loadSample spins up a new instance with required extensions and seeds the scratchpad with sample queries.mainDb.importSqlDump and exportSqlDump; import resets the public schema before replaying SQL.static/banner.png.npm run dev - start the dev servernpm run check - type-check and lintnpm test - run unit testsnpm run build - production buildTBD
TBD
Let me know if you appreciate PGPlayground by sending a tip or giving the repository a star ⭐
MPL-2.0. See LICENSE.
Choosing a license is always controversial. I chose the MPL for now, but I'm open to changing it later if someone can make a good argument for a different one.