Go SDK, examples, and project templates for building WebAssembly components that run on wasmCloud v2.
component(go.wasmcloud.dev/component) — the component SDK: write HTTP handlers with standardnet/httptypes and compile them to WASI components with big Go via componentize-go. Two worlds are supported: a sync WASI P2 world (default, stock Go) and an async WASI P3 world (wasi:http@0.3.0, streaming bodies and native goroutine concurrency).component/nats— NATS-native messaging onwasmcloud:nats@0.1.0: core pub/sub and request-reply, JetStream, and JetStream KV, for what the portablecomponent/messagingpackage cannot express — acknowledged delivery and redelivery, replay from an arbitrary stream position, and compare-and-swap on a KV revision. Every function on the interface is async, so a component importing it targets WASI P3.examples/components— runnable example components, each a standalone Go module.templates— starter templates forwash new.x— experimental libraries.
wash new https://github.com/wasmCloud/go.git --name my-component \
--subfolder templates/http-hello-world
cd my-component
wash dev| Example | Shows | WASI P3 |
|---|---|---|
| http-server | HTTP routing and handlers via net/http |
|
| http-client | Outbound HTTP with http.RoundTripper |
|
| http-password-checker | A small JSON API | |
| http-keyvalue-crud | HTTP CRUD over host-served wasi:keyvalue |
|
| http-otel | OpenTelemetry tracing via the host's wasi:otel plugin |
|
| http-p3-streaming | Async WASI P3: streaming echo + concurrent outbound fan-out | ✅ |
| nats-request-reply | Core NATS request-reply: a responder plus an HTTP gateway that calls it | ✅ |
| nats-jetstream-orders | JetStream delivery into KV, with ack/nak and compare-and-swap | ✅ |
| nats-kv-watch | Watching a JetStream KV bucket and rebuilding derived state | ✅ |
| nats-stream-replay | JetStream replay by sequence or range, and a pull consumer you settle yourself | ✅ |
The unmarked examples build as sync WASI P2 components with stock Go. The
marked ones target the async P3 world: http-p3-streaming asks for it
directly, and the nats-* examples inherit it because every function on
wasmcloud:nats@0.1.0 is async. componentize-go selects a patched Go
toolchain for those automatically — see
http-p3-streaming.
wasmCloud v2 removed wadm manifests, capability providers, and the
wasmcloud:bus interface; the v1-era provider SDK
(go.wasmcloud.dev/provider) and TinyGo component SDK line (v0.0.x) are
no longer developed on main, though existing module versions
keep resolving. See MIGRATING.md.