Skip to main content

Interfaces

Modules and components

WebAssembly binaries may be components built according to the Component Model or modules built to the core WebAssembly specification.

As you begin writing a Wasm application using WASI APIs, one of your first decisions will be which type of binary you want to produce—a decision typically guided by your use-case and the runtime you wish to use. Check to see which WASI releases your runtime supports.

  • Components can use WASI 0.2 and the Component Model for composability and interoperability, meaning that a WebAssembly component compiled from one language (Rust, for example) can communicate or be combined with a component compiled from another language (such as Go). WASI 0.2 sets the stage for the future of WASI.

  • Modules can use APIs from WASI 0.1, an earlier stage of WASI's development. Since WASI 0.2 was released in February 2024, WASI 0.1 support is more widespread among Wasm runtimes, and it is widely used in production today.

WASI 0.2

WASI 0.2 is the most recent WASI release. APIs designed for WASI 0.2 and the Component Model are defined with the WebAssembly Interface Type (WIT) Interface Description Language (IDL). WIT API definitions are made in .wit files which are composed into Wasm component binaries. The following interfaces are included in WASI P2:

APIRepositoryVersion
I/Ohttps://github.com/WebAssembly/wasi-io0.2.0
Clockshttps://github.com/WebAssembly/wasi-clocks0.2.0
Randomhttps://github.com/WebAssembly/wasi-random0.2.0
Filesystemhttps://github.com/WebAssembly/wasi-filesystem0.2.0
Socketshttps://github.com/WebAssembly/wasi-sockets0.2.0
CLIhttps://github.com/WebAssembly/wasi-cli0.2.0
HTTPhttps://github.com/WebAssembly/wasi-http0.2.0

You can explore the types and definitions for a given WASI 0.2 API in its WIT files. When you're ready to start using the API, you will typically generate bindings between the WIT definitions and the language you will be compiling to Wasm. For more information on WIT, see the WIT section of the Component Model documentation.

WASI 0.1

WASI P1 APIs were defined with WITX Interface Description Language (IDL), which was an iterative step toward WIT but bears notable differences, including that it was developed as a lower-level derivation of WebAssembly Text Format (a human-readable source format for Wasm modules). Documentation for WASI 0.1 and WITX can be found in the legacy directory of the WASI GitHub repository, along with a complete list of 0.1 types and modules.

Proposals for the standard

All WASI APIs are proposals for standardization by the WASI Subgroup. The API proposals in WASI 0.1 and 0.2 met implementation and portability criteria for inclusion at the time of those releases.

All active WASI API proposals can be found on the WASI GitHub repository, along with the process for making a proposal.