...
1+++
2title = "the _zero_ dependency _WebAssembly_ runtime for _Go developers_"
3layout = "home"
4+++
5
6
7**WebAssembly** is a way to safely run code compiled in other languages. Runtimes
8execute WebAssembly Modules (Wasm), which are most often binaries with a
9`.wasm` extension.
10
11**wazero** is the only zero dependency WebAssembly runtime written in Go.
12
13## Get Started
14
15**Get the wazero CLI** and run any Wasm binary
16
17```bash
18curl https://wazero.io/install.sh | sh
19./bin/wazero run app.wasm
20```
21
22**Embed wazero** in your Go project and extend any app
23
24```go
25import "github.com/tetratelabs/wazero"
26
27// ...
28
29r := wazero.NewRuntime(ctx)
30defer r.Close(ctx)
31mod, _ := r.Instantiate(ctx, wasmAdd)
32res, _ := mod.ExportedFunction("add").Call(ctx, 1, 2)
33```
34
35-----
36
37## Example
38
39The best way to learn wazero is by trying one of our [examples][1]. The
40most [basic example][2] extends a Go application with an addition function
41defined in WebAssembly.
42
43## Why zero?
44
45By avoiding CGO, wazero avoids prerequisites such as shared libraries or libc,
46and lets you keep features like cross compilation. Being pure Go, wazero adds
47only a small amount of size to your binary. Meanwhile, wazero’s API gives
48features you expect in Go, such as safe concurrency and context propagation.
49
50### When can I use this?
51
52You can use wazero today! wazero's [1.0 release][3] happened in March 2023, and
53is [in use]({{< relref "/community/users.md" >}}) by many projects and
54production sites.
55
56You can get the latest version of wazero like this.
57```bash
58go get github.com/tetratelabs/wazero@latest
59```
60
61Please give us a [star][4] if you end up using wazero!
62
63[1]: https://github.com/tetratelabs/wazero/blob/main/examples
64[2]: https://github.com/tetratelabs/wazero/blob/main/examples/basic
65[3]: https://tetrate.io/blog/introducing-wazero-from-tetrate/
66[4]: https://github.com/tetratelabs/wazero/stargazers
View as plain text