Live Share: Connect to in-browser PGlite with any Postgres client
database.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.
Related posts
- postgres.new: In-browser Postgres with an AI interface
Supabase mediumAdeptdatabase.build (formerly postgres.new) runs unlimited Postgres databases entirely in the browser via PGlite, a WASM build of Postgres, paired with GPT-4o that has full autonomy over the disposable database. The LLM imports CSVs, generates Chart.js charts, builds ER diagrams from real DDL, and does in-browser semantic search using pgvector and Transformers.js. SQL errors are fed back to the model so it can self-correct, and embeddings are stored in a meta table and referenced by ID to avoid sending large vectors to the model. PGlite relies on Postgres's single-user mode plus wire protocol support, a /dev/blob virtual device for COPY, and IndexedDB/OPFS persistence. A new TypeScript library, pg-gateway, handles the startup/auth handshake so standard Postgres clients can connect to PGlite deployments.
- Postgres WASM by Snaplet and Supabase
Supabase mediumAdeptpostgres-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.
- psql from the browser
Neon easyNovice
psql.sh is a browser-based emulation of Postgres's psql client, built on Neon's WebSocket proxy and serverless driver because browsers can't open raw TCP connections. Each session gets a fresh, isolated database by creating a child branch from a template branch, which yields a connection string almost instantly. Slash commands like \d reuse the Neon SQL Editor's library. The terminal UI was built from scratch instead of using xterm.js, since only a psql session needs emulating. The project is open source.
- 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.
- Quicker serverless Postgres connections
Neon mediumAdept
Neon cut the network round-trips needed to get a first query result from its WebSocket-based serverless Postgres driver from nine to four. It moved to TLS 1.3, ran Postgres unencrypted inside a secure wss: WebSocket (or pipelined SSLRequest with the TLS Client Hello), and replaced CPU-heavy SCRAM-SHA-256 with plain password auth over TLS, since Neon only issues long random passwords. It also pipelined the startup, password and query messages into a single send. Pipelining at first added up to 50ms of delay over short distances because of Nagle's algorithm, fixed by setting TCP_NODELAY in the proxy. QUIC-based WebSockets or WebTransport might cut the count further.