WASI (WebAssembly System Interface) — the syscall standard for WASM modules running outside the browser (server, CLI, edge). Lets WASM read files, open sockets, use clocks — but only via capability-based access (the caller passes in a handle, the module cannot gethostname-allocate on its own). WASI 0.2 (2024) is built on Component Model. Runtimes: Wasmtime, WasmEdge, Spin.
Below: details, example, related terms, FAQ.
// Rust → WASI binary
$ cargo build --target wasm32-wasi --release
$ wasmtime --dir=. target/wasm32-wasi/release/app.wasm
// Fermyon Spin app.toml
[[component.trigger]]
route = "/"
[component.source]
path = "target/wasm32-wasi/release/hello.wasm"Docker = linux kernel + container runtime. WASI = capability API, kernel-less isolation, cold-start ~1 ms vs ~100 ms for Docker.
For CLI, plugins, serverless — yes (Fastly, Shopify). Full web-server on WASI — still experimental (no async sockets in preview2).
WASI 0.2 adds async (poll_oneoff). Tokio for WASI — integration in progress.