the zero dependency WebAssembly runtime for Go developers
WebAssembly is a way to safely run code compiled in other languages. Runtimes
execute WebAssembly Modules (Wasm), which are most often binaries with a
.wasm
extension.
wazero is the only zero dependency WebAssembly runtime written in Go.
Get Started
Get the wazero CLI and run any Wasm binary
curl https://wazero.io/install.sh | sh
./bin/wazero run app.wasm
Embed wazero in your Go project and extend any app
import "github.com/tetratelabs/wazero"
// ...
r := wazero.NewRuntime(ctx)
defer r.Close(ctx)
mod, _ := r.Instantiate(ctx, wasmAdd)
res, _ := mod.ExportedFunction("add").Call(ctx, 1, 2)
Example
The best way to learn wazero is by trying one of our examples. The most basic example extends a Go application with an addition function defined in WebAssembly.
Why zero?
By avoiding CGO, wazero avoids prerequisites such as shared libraries or libc, and lets you keep features like cross compilation. Being pure Go, wazero adds only a small amount of size to your binary. Meanwhile, wazero’s API gives features you expect in Go, such as safe concurrency and context propagation.
When can I use this?
You can use wazero today! wazero’s 1.0 release happened in March 2023, and is in use by many projects and production sites.
You can get the latest version of wazero like this.
go get github.com/tetratelabs/wazero@latest
Please give us a star if you end up using wazero!