Postgres WASM by Snaplet and Supabase
postgres-wasm runs a full PostgreSQL 14 server in the browser by emulating an x86 machine with v86 rather than compiling Postgres to WASM directly. It boots a minimal Buildroot Linux image and lazily loads the rest over a 9P filesystem via HTTPS, and it uses the page_poison=on kernel parameter so freed memory compresses well, which brings the snapshot of a running Postgres down to about 12MB. Networking goes through a forked websockproxy that converts raw ethernet frames into TCP, with an nginx reverse proxy that maps private IPs to ports so external clients like psql, PgAdmin or a logical replication peer can connect. Other hurdles included a v86 JIT bug that caused PG14 segfaults, worked around by switching Postgres to sysv shared memory, and an inbox-folder listener for running scripts inside the VM.
Related posts
- Live Share: Connect to in-browser PGlite with any Postgres client
Supabase mediumAdeptdatabase.build (formerly postgres.new) adds Live Share, which exposes an in-browser PGlite (WASM Postgres) database via a unique connection string usable from psql, pg_dump, ORMs or IDEs. A WebSocket-to-TCP proxy keeps a persistent WebSocket as a reverse tunnel to the browser, while pg-gateway terminates client TCP connections, handles startup, auth and the Postgres SSLRequest upgrade, and reads the TLS SNI server name to route each connection, since Postgres has no HOST header and off-the-shelf proxies can't do SNI routing behind its STARTTLS-style handshake. PGlite's single-connection limit breaks clients that open parallel connections (Prisma shadow DBs, DBeaver defaults), COPY FROM STDIN is unsupported, and multiplexing was rejected due to shared transaction and extended-query state.
- Edge-compatible Serverless Driver for Postgres
Neon mediumAdept
Neon's @neondatabase/serverless driver lets V8-isolate platforms like Cloudflare Workers, which lack TCP, speak the real Postgres wire protocol by tunnelling it over a WebSocket to an open-source Go proxy that relays to TCP. The driver is node-postgres with shims for Node APIs, and it does end-to-end TLS 1.3 via WolfSSL compiled to WebAssembly with Asyncify, offloading crypto to SubtleCrypto. Because SCRAM-SHA-256's 4,096 hash rounds exceed Workers' 10–50ms CPU limits, it falls back to cleartext auth over mandatory TLS. The post also covers latency tradeoffs from the extra proxy hop, round-trip reductions, and how to self-host the proxy for any Postgres.
- Postgres Foreign Data Wrappers with Wasm
Supabase mediumAdeptSupabase Wrappers, a Rust framework for building Postgres Foreign Data Wrappers, now supports WebAssembly FDWs that are downloaded from URLs like GitHub or S3, checksum-verified, cached and run in a sandboxed Wasm runtime inside the Postgres extension. The host extension provides the runtime, an HTTP interface and utilities, while each guest FDW fetches data from HTTP JSON APIs. TCP-based databases and local files are not yet supported. Snowflake and Paddle Wasm FDWs ship built in, a SQL walkthrough shows creating a Paddle server and foreign table, and wrappers from untrusted sources should never be installed.
- Supabase is now on Postgres 13.3
Supabase easyNoviceNew Supabase projects now run Postgres 13.3 (up from 12.0), bringing native gen_random_uuid, parallel index vacuuming, incremental sorting and smaller B-tree indexes. Supabase Postgres versioning now tracks upstream major/minor versions, and Postgres is built from source so ARM Graviton 2 instances can use Large System Extensions (LSE) for faster atomics and locking, with pgbench comparisons on m6gd.8xlarge. The release also moves to Ubuntu 20.04, adds the pgRouting and wal2json extensions, configures fail2ban on ports 5432 and 6543 (10-minute ban after three failed attempts), and previews PgBouncer/PostgREST marketplace bundles.
- How We Built the Turso Shell in the Browser
Turso mediumAdeptTurso's SQLite-compatible database can run entirely in the browser via WebAssembly, persisting data to OPFS with no backend. The walkthrough builds a SQL shell with Vite, React and TypeScript. It covers importing from the @tursodatabase/database-wasm/vite export to work around a Vite dev-server WASM issue, and setting COOP/COEP headers so SharedArrayBuffer is available. It then builds a query executor that maps prepared-statement results into a table, and upgrades the textarea to a CodeMirror editor with SQL highlighting, autocomplete and a Mod-Enter keybinding.