Skip to content

What is WASI

Key idea:

WASI (WebAssembly System Interface) — standard API for WebAssembly outside the browser. Gives WASM access to filesystem, network, env vars in a sandboxed way. Enables server-side WASM: Fastly Compute@Edge, Fermyon Spin, Docker WASM containers, Envoy WASM filters. Competes with containers for lightweight serverless. Runtimes: Wasmtime (Mozilla), WasmEdge, WasmCloud.

Below: details, example, related terms, FAQ.

Details

  • WASI Preview 1: basic POSIX-like interface (deprecated — 2019)
  • WASI Preview 2 (2024 stable): component model, world interfaces
  • Sandboxing: capability-based security (explicit file/net access)
  • Start time: 1-5 ms vs container 100ms+ vs JVM 1s+
  • Languages: Rust, C/C++, Go, Python, TinyGo all compile to WASI

Example

// Rust → WASI
// Cargo.toml
[dependencies]
wasi = "0.13"

// main.rs
use std::fs;
fn main() {
    let content = fs::read_to_string("/data/input.txt").unwrap();
    println!("{}", content);
}

// Build: cargo build --target wasm32-wasi
// Run: wasmtime --dir=/host/data main.wasm

Related Terms

Learn more

Frequently Asked Questions

WASI vs containers?

WASI: much faster start, smaller (KB vs MB), language-neutral. Containers: more compatibility with existing software. For serverless/edge — WASI wins.

When is it production-ready?

Preview 2 released stable in 2024. Fastly, Cloudflare Workers use it internally. For mainstream — 2026+.

Replacement for containers?

Not a replacement, a complement. Containers stay for legacy apps. New edge functions, plugins, serverless — WASI.