WASI Preview 2

The WASI P2 backend runs WebAssembly modules in a sandbox using the Wasmtime runtime with WASI Preview 2 enabled, including WASI-HTTP for outbound HTTP/HTTPS requests from WASM modules. It's cross-platform and requires no virtualization or container runtime.

Requirements

  • The wasmtime CLI on PATH

Installation

Install Wasmtime:

curl https://wasmtime.dev/install.sh -sSf | bash

Or follow the Wasmtime install guide for your platform.

Default image

The default image is the bundled wasi-p2-shell.wasm. Override per-sandbox with --image.

Usage

heyvm --backend-type wasip2

Static file serving with Spin

heyvm create --name docs \
  --backend-type wasip2 \
  --image spinframework/spin-fileserver \
  --mount "/path/to/docs:/public"