WebAssembly · WIT · Rust · Go · wasmtime · wasmCloud · Kubernetes

API Patterns and Practices: Server-Side WebAssembly

Designing and deploying server-side WebAssembly components well, with runnable examples in Rust and Go against one WIT contract, running on wasmtime and wasmCloud and deployed to Kubernetes on minikube and OpenShift Local.

📐One WIT world as the single source of truth for every component interface
🦀Every example in both Rust and Go
⚙️The same component on wasmtime and on wasmCloud
☸️Deployed on minikube and OpenShift Local, traced through the Grafana LGTM stack

What this site is

A chapter-based, hands-on path to designing and deploying server-side WebAssembly components well, built around a single WIT world for a shipping and cargo domain. Every hands-on chapter ships the same example in both Rust (cargo-component, targeting wasm32-wasip2) and Go (standard Go: wasip1 plus go:wasmexport and the wasm-tools adapter, with TinyGo noted as the size-optimized alternative). The component serves HTTP via wasi-http and talks gRPC, runs on wasmtime and on wasmCloud unchanged, and deploys to Kubernetes on minikube (the containerd Wasm shim) and OpenShift Local. Later parts cover Kubernetes patterns (sidecar, ambassador/adapter, HPA scaling, scale-to-zero with KEDA), on-cluster observability with OTel and the Grafana LGTM stack, and then the deviations: Istio and WebAssembly (the WasmPlugin CRD), a survey of other Wasm backend architectures (serverless/FaaS with Spin), and portable inference with wasi-nn. Cross-reference the sibling REST and gRPC sites for the HTTP and gRPC protocol detail. It assumes you can read Rust and Go; it is not a tutorial in either language. All container images are UBI-based.

Part 0

Prerequisites

Get the toolchain running locally: Rust with cargo-component, Go with wasm-tools, wasmtime and wasmCloud's wash CLI, plus minikube and CRC for the deploy chapters and the LGTM stack for observability.

2 chapters Explore →
Part 1

Foundations

Where server-side Wasm fits alongside containers, how the sandboxed execution model and capability-based security work, the Component Model and WIT as the contract between components, WASI Preview 2's host interfaces, and the shared cargo domain this site builds as components.

5 chapters Explore →
Part 2

Building Components in Rust & Go

Build the first component in Rust and the first in Go, compose both against shared WIT worlds, and work through the debugging and error-handling patterns a Wasm component needs that a native binary doesn't.

5 chapters Explore →
Part 3

Interfaces: HTTP & gRPC

Serve HTTP and gRPC directly from a component, and handle the networking, reconnect, and resilience concerns a sandboxed component faces differently than a conventional service.

3 chapters Explore →
Part 4

Runtimes: wasmtime & wasmCloud

Run components standalone under wasmtime, then move to wasmCloud's distributed actor model for linking and scaling, and see where the two runtimes combine in one deployment.

3 chapters Explore →
Part 5

Deploying to Kubernetes

Run Wasm workloads on minikube and OpenShift Local (CRC), place a component as a sidecar or an ambassador/adapter, scale with the HPA and scale to zero with KEDA, and bring up observability on-cluster.

8 chapters Explore →
Part 6

Deviations

Branch out from the core stack: Proxy-Wasm and the Istio WasmPlugin CRD, where else server-side Wasm shows up in backend architectures, and wasi-nn for portable inference from a component.

3 chapters Explore →
Part 7

Final Project

Bring the shipping/cargo domain together end to end across both languages and both runtimes, deployed on-cluster with a single trace in Grafana tying the request path together.

1 chapter Explore →