Examples
Every runnable example in this repo, mapped to the chapter it supports.
Every hands-on chapter ships a runnable example under
examples/,
built against the one WIT world in
contracts/wit.
Most examples carry both a Rust and a Go component behind that shared
contract; the runtime and deployment examples take the composed artifact and run
it on wasmtime, wasmCloud, minikube, and OpenShift Local.
| Example | What it shows | Stacks | Chapter |
|---|---|---|---|
| part2-building-components | The Rust and Go provider and consumer components, and the native host that proves both behave identically | Rust + Go | Chapter 6 to Chapter 8 |
| part3-interfaces | wasi-http front doors, protobuf in a component, the tonic gRPC bridge, and wasi-sockets reconnect | Rust + Go | Chapter 11 to Chapter 13 |
| part4-runtimes/wasmtime-host | The component embedded directly with wasmtime under fuel, epoch, and memory limits | Rust | Chapter 14 |
| part4-runtimes/wasmcloud | The same component run under the wasmCloud lattice, with the same-bytes proof against wasmtime | Rust | Chapter 15 to Chapter 16 |
| part5-kubernetes/k8s | Deploy to minikube under the containerd-shim-wasmtime RuntimeClass, through ingress-nginx | Rust + Go | Chapter 18 |
| part5-kubernetes/openshift | The same component on OpenShift Local (CRC) via the wasmCloud operator and an edge-TLS Route | Rust + Go | Chapter 19 |
| part5-kubernetes interposition | Sidecar filter, ambassador egress grant, and adapter shape-translation interposed on the provider | Rust + Go | Chapter 20 to Chapter 21 |
| part5-kubernetes/k8s/scaling | A stock Horizontal Pod Autoscaler wired to a Wasm Deployment | Rust + Go | Chapter 22 |
| part5-kubernetes/k8s/keda | KEDA HTTP scale-to-zero and Kafka lag scaling, with the native kafka-host | Rust + Go | Chapter 23 |
| part5-kubernetes/k8s/observability | The containerd shim’s OTel export into the LGTM stack | Rust + Go | Chapter 24 |
| part6-deviations/istio | The proxy-wasm gateway filter enforcing the x-cargo-tenant contract on the Istio ingress |
Rust + Go | Chapter 25 |
| part6-deviations/spinkube | The Spin app on SpinKube (minikube) and in a restricted-v2 container (CRC) | Rust | Chapter 26 |
| part6-deviations/wasi-nn | wasi-nn image classification from a component, on the OpenVINO backend | Rust | Chapter 27 |
| part7-final-project | The final project: both language composites behind the Istio filter, with OTel, on minikube and CRC | Rust + Go | Chapter 28 |
Build, run, observe
Each example is self-contained: a README.md, a build script, and a verify*.sh
(or run.sh) that builds the component against the shared WIT contract, runs it,
and asserts its behavior. The cluster examples assert a real HTTP response through
the edge, with no port-forward and no NodePort.
cd examples/part2-building-components && ./verify.sh # local: both components + host
cd examples/part5-kubernetes/k8s && ./verify-minikube.sh # cluster: minikube
Each chapter’s Build, run, observe section names the exact script for that example and what it asserts. See Setup for the toolchain.