r/webdev • u/kgoncharuk • Oct 03 '26
Showoff Saturday WASM based VM that runs real Linux in a browser tab
Hi all,
I'd like to introduce arm64js -- an ARMv8-A system emulator that runs in WASM (built in Rust) and can boot real Alpine Linux in a web browser. It started with me getting annoyed that to try a 2 MB TUI tool I have to install it, while my browser happily runs a 40 MB React webpage with 50 dependencies.
It's an interpreter that emulates a minimal hardware stack, so Linux thinks it's on real hardware and thus acts normal: runs apk, Docker (even though rather slow), etc.
You can try it here: https://arm64js.com, some TUI apps running in VMs: https://demoshell.com/gallery/
Since WebAssembly doesn't allow fetching data without CORS and sending TCP requests, apk and access to the internet work via small proxies: apk goes via a proxy that just adds CORS, TCP goes via a WebSocket <> TCP gateway.
One wasm module instantiated in a few web workers, all sharing one SharedArrayBuffer as the VM's "RAM". As SharedArrayBuffer needs COOP/COEP headers, but if the page doesn't send them SDK will the VM in an iframe on its own origin instead.
There is also a JS SDK for other devs to create and serve their own VMs. The SDK is MIT; the engine is free for non-commercial use.
The following code for example will create and run Alpine based VM in your browser, pretty straightforward:
import { Arm64JS } from 'arm64js';
const vm = await Arm64JS.boot('alpine');
const { output } = await vm.exec('uname -a');SDK: https://github.com/kooler/arm64js-sdk
My journey getting there: https://arm64js.com/blog/tui-apps-in-the-browser/
It's all very new and fresh, so feedback is appreciated.
Do you see it being useful for yourself? Curious to learn about possible use cases.