Hermitbox demo · box
A Linux box that sleeps for free and wakes on a keystroke
This is a real Linux kernel, compiled to WebAssembly, running inside one Cloudflare Durable Object. Its disk is rows in the object's SQLite database. Stop typing for 30 seconds and the machine is snapshotted into the same database and stopped, so the object can leave memory and costs nothing but storage. Press a key and it comes back where it was.
Each visitor gets a box of their own: 48 MB of memory, 128 MB of disk, one CPU and no network. It is deleted 15 minutes after it is made.
Try: echo hello > /data/note, then Sleep now, then a key.
Open the copied link in another tab: both see the same machine.
How it works
- The kernel is unkernel: Linux 7.3 built for WebAssembly, with an aarch64 CPU emulator for user programs. Here it boots its base system: busybox and a shell.
- The disk is a block device whose 4 KiB blocks are rows in the Durable Object's SQLite database. Blocks never written take no space.
- Sleep is a snapshot of the guest's memory, stored in the same database (zero pages skipped), and then the kernel stops. The terminal's WebSocket is a hibernatable one, so it stays open while the object is evicted.
- Wake is the next message on that WebSocket: Cloudflare starts the object again, it reads the snapshot back and resumes the kernel, and your key reaches the same shell.
The source and how to run it on your own account: examples/box.
Hand it to your agent: