PostgreSQL in the Browser
The ZeroFS Web UI terminal boots a Linux VM inside the browser and mounts ZeroFS at /mnt over 9P. PostgreSQL can use that mount for its data directory.
This is a demonstration, not a deployment recommendation.
I/O Path
A write from PostgreSQL passes through these layers. ZeroFS batches writes into immutable segment objects rather than forwarding each one to the object store:
psql → PostgreSQL → Linux kernel → virtio-9p → v86 → WebSocket → ZeroFS → object store
PostgreSQL sees a local filesystem. The Linux kernel sees a 9P fileserver. ZeroFS sees an ordinary 9P client.
An ordinary write acknowledgment does not wait for an object-store upload. ZeroFS compresses and encrypts each 32 KiB extent into a frame inside an in-memory segment buffer; the buffer is uploaded as one immutable segment object when it reaches 256 MiB or when an fsync forces a seal. PostgreSQL's fsync of its WAL arrives as a 9P Tfsync, which seals and uploads the open segment before returning (see Durability and consistency).
Why It Works
The Web UI terminal uses v86, a JavaScript x86 emulator that runs a Linux kernel in the browser. The guest loads the 9P kernel modules from its initramfs and mounts a virtio-9p device that v86 bridges over a WebSocket back to ZeroFS. On the ZeroFS side, the WebSocket terminates at the same NinePHandler that serves TCP clients.
There is no separate browser filesystem implementation. The Web UI uses the shared Rust zerofs-client compiled to WebAssembly, and the WebSocket connection terminates at the same NinePHandler that serves TCP clients. The durability path is therefore the same for both transports.
Run the Demo
Enable the Web UI in your ZeroFS configuration:
[servers.webui]
addresses = ["127.0.0.1:8080"]
uid = 1000
gid = 1000
Start ZeroFS, open http://127.0.0.1:8080, and switch to the terminal tab. The VM boots in a few seconds and drops you into a shell at /mnt.
The VM ships with BusyBox; it does not include PostgreSQL. The v86 guest is a 32-bit x86 machine, so PostgreSQL must be a static 32-bit x86 (i386) build. Place the binaries on the ZeroFS filesystem from another client (NFS, 9P, or the Web UI file manager). The guest sees that filesystem at /mnt; because it mounts with cache=loose, a newly added file can require a fresh directory listing before it appears.
# From another machine or the file manager, copy a static 32-bit x86
# (i386) PostgreSQL build onto the ZeroFS filesystem, e.g. into /postgres
# Then from the terminal tab:
export PATH=/mnt/postgres/bin:$PATH
export LD_LIBRARY_PATH=/mnt/postgres/lib
initdb -D /mnt/pgdata
pg_ctl -D /mnt/pgdata -l /mnt/pgdata/logfile start
psql -d postgres
CREATE TABLE notes (id serial, body text);
INSERT INTO notes (body) VALUES ('written from a browser tab');
SELECT * FROM notes;
The database files persist in the configured object store. After reopening the tab, start PostgreSQL again to access the same rows.
Limitations
A 128 MB VM inside a JavaScript x86 emulator is not a replacement for a database server. The guest has no network device, uses a cache=loose 9P mount, and loses its running processes whenever the tab or VM closes. This page demonstrates protocol compatibility and persistence, not a production deployment.