github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/site/content/_index.md (about)

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