Skip to content

WebAssembly Component Model

Key idea:

Component Model — a 2024+ standard that lets WASM modules exchange rich types (records, variants, strings, lists) without manual serialization. Interfaces are described in WIT (WebAssembly Interface Type). Runtimes: Wasmtime, WasmEdge. Upshot: JavaScript can import a Rust component as a regular npm package (ComponentizeJS, JCO).

Below: details, example, related terms, FAQ.

Try it now — free →

Details

  • WIT — .wit files describe the interface between components
  • Canonical ABI: records/variants/strings cross the boundary without FFI
  • jco (JS Component Tools) — transpile .wasm → pure JS
  • Wasmtime 14+ — host runtime with Component Model out of the box
  • WASI 0.2 is built on the Component Model

Example

// hello.wit
package example:hello;
world app {
    export greet: func(name: string) -> string;
}

// Rust implementation
#[export_name = "greet"]
pub extern "C" fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

Related

Learn more

Frequently Asked Questions

How is this different from plain WASM?

Older WASM modules exchanged only i32/i64/f32/f64 and pointers in shared memory. Component Model adds rich types.

Production uses?

Fastly Compute@Edge, Cloudflare Workers (experimental), Fermyon Spin.

Why does this matter?

Language-agnostic microservices: write a component in Rust, import it from JS/Python/Go natively — no REST/gRPC/serialization.