Company
Date Published
Author
Mark Burggraf
Word count
1965
Language
English
Hacker News points
887

Summary

The developers have open-sourced `postgres-wasm`, a PostgreSQL server that runs inside a browser, allowing for a full suite of features including persisting state to the browser and restoring from pg_dump. The project was developed in collaboration with Snaplet, which provides production-accurate data and preview databases for developers. The demo version has several neat features such as Postgres 14.5, psql, pg_dump, and more. However, running Postgres in the browser isn't suitable for general use-cases due to its size and performance limitations. The project overcomes these challenges by booting only a minimal Linux image and dynamically loading the rest of the VM over HTTPS after initialization. The networking aspect is also solved using Websockets, allowing communication between the virtual machine and the outside world. The developers have created a fork of Websockproxy to provide a reverse proxy for incoming traffic, enabling users to connect to the PostgreSQL instance running inside their browser. The project has potential applications in offline data analysis, testing, and development environments.