Templates & Examples
Get started building components for wasmCloud.
- Templates are scaffolds for new applications. Use
wash newto create a project from a template, then customize it for your use case. - Examples are complete applications demonstrating specific wasmCloud capabilities.
All templates and examples on this page target wasmCloud v2 and require wash 2.0.0+. Components target the WASI 0.2 component model. Interface versions shown reflect what is pinned in each template or example at time of writing; wash new always pulls current source from the repository.
Templates
| Template | Language | Description |
|---|---|---|
| HTTP Hello World | Rust | HTTP server using wstd |
| TCP Service | Rust | HTTP API + TCP service workspace |
| HTTP Hello World (Hono) | TypeScript | HTTP server using Hono |
| HTTP Hello World (Fetch API) | TypeScript | HTTP server using the Fetch API |
| HTTP Client | TypeScript | Outgoing HTTP proxy |
| HTTP Service (Hono) | TypeScript | Full REST API service |
| HTTP Service with Blob Storage (Hono) | TypeScript | REST API + wasi:blobstore |
| HTTP Service with Key-Value Storage (Hono) | TypeScript | REST API + wasi:keyvalue |
Rust
Requires the Rust toolchain with the wasm32-wasip2 target. After scaffolding with wash new, run wash dev from the project directory to start the development loop. See Quickstart prerequisites for setup instructions.
HTTP Hello World
A minimal HTTP server component built with the wstd async runtime for Wasm components.
- Source:
wasmCloud/wash — templates/http-hello-world - Interfaces: Exports
wasi:http/incoming-handler
wash new https://github.com/wasmCloud/wash.git --name my-project --subfolder templates/http-hello-worldTCP Service
A two-component Rust workspace. http-api is an HTTP server that accepts text input via a web UI and forwards it to service-leet, a TCP server that transforms text to "leet speak" (e.g., hello world → h3110 w0r1d). Together they demonstrate a multi-component service pattern with TCP transport.
- Source:
wasmCloud/wash — templates/service-tcp http-apiinterfaces: Exportswasi:http/incoming-handler; makes outgoing TCP connectionsservice-leetinterfaces: TCP server (listens on port 7777)
wash new https://github.com/wasmCloud/wash.git --name my-service --subfolder templates/service-tcpTypeScript
Requires npm v14.17+ and TypeScript v5.6+. After scaffolding with wash new, run npm run dev from the project directory to start the development loop. See Quickstart prerequisites for setup instructions.
TypeScript templates use the @bytecodealliance/jco-std adapter for WASI compatibility and are available on the v2 branch of wasmCloud/typescript.
HTTP Hello World (Hono)
A minimal HTTP server component using the Hono web framework.
- Source:
wasmCloud/typescript — templates/http-hello-world-hono - Interfaces: Exports
wasi:http/incoming-handler@0.2.6
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-hello-world-hono --git-ref v2HTTP Hello World (Fetch API)
A minimal HTTP server component using the Service Worker Fetch API pattern.
- Source:
wasmCloud/typescript — templates/http-hello-world-fetch - Interfaces: Exports
wasi:http/incoming-handler@0.2.3
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-hello-world-fetch --git-ref v2HTTP Client
An HTTP proxy component that makes outgoing HTTP requests. Supports GET, POST, PUT, DELETE, and PATCH with custom header forwarding, request body handling, JSON parsing, and response header extraction.
- Source:
wasmCloud/typescript — templates/http-client - Interfaces: Imports
wasi:http/outgoing-handler@0.2.3; exportswasi:http/incoming-handler@0.2.3
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-client --git-ref v2HTTP Service (Hono)
A full-featured HTTP service component using Hono, demonstrating middleware patterns including CORS, request logging, response timing, and request ID tracking, with RESTful CRUD endpoints and error handling.
- Source:
wasmCloud/typescript — templates/http-service-hono - Interfaces: Exports
wasi:http/incoming-handler@0.2.3
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-service-hono --git-ref v2HTTP Service with Blob Storage (Hono)
An HTTP service component using Hono, backed by wasi:blobstore for persistent file storage. Provides a complete REST API for blob CRUD operations.
- Source:
wasmCloud/typescript — templates/http-blobstore-service-hono - Interfaces: Imports
wasi:blobstore/blobstore@0.2.0-draft; exportswasi:http/incoming-handler@0.2.6
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-blobstore-service-hono --git-ref v2HTTP Service with Key-Value Storage (Hono)
An HTTP service component using Hono, backed by wasi:keyvalue for persistent key-value storage. Demonstrates CRUD operations, atomic incrementation, and Hono middleware patterns. When run with npm run dev, a NATS-KV key-value provider is automatically configured.
- Source:
wasmCloud/typescript — templates/http-kv-service-hono - Interfaces: Imports
wasi:keyvalue/store@0.2.0-draft,wasi:keyvalue/atomics@0.2.0-draft; exportswasi:http/incoming-handler@0.2.6
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-kv-service-hono --git-ref v2Examples
Complete example applications are available in the examples/ directory of wasmCloud/wash. Run wash dev from any example directory to build and start a local development environment.
| Example | Language | OCI Artifact |
|---|---|---|
| HTTP Hello World (Rust) | Rust | ghcr.io/wasmcloud/components/hello-world:0.1.0 |
| Blobby | Rust | — |
| QR Code Generator | Rust | — |
| HTTP Hello World (Go) | Go | — |
Rust
HTTP Hello World (Rust)
A simple HTTP server demonstrating how to handle HTTP requests using the wstd async runtime.
- Source:
wasmCloud/wash — examples/http-hello-world - OCI artifact:
ghcr.io/wasmcloud/components/hello-world:0.1.0 - Kubernetes manifest:
examples/http-hello-world/manifests/workloaddeployment.yaml - Interfaces: Exports
wasi:http/incoming-handler
Blobby
A file server component ("Little Blobby Tables") demonstrating CRUD operations on blob storage, served through a web UI.
- Source:
wasmCloud/wash — examples/blobby - Interfaces: Imports
wasi:blobstore/blobstore@0.2.0-draft,wasi:logging/logging@0.1.0-draft; exportswasi:http/incoming-handler@0.2.1
QR Code Generator
A QR code generator that accepts text input via HTTP and returns a PNG-encoded QR code, with a web UI.
- Source:
wasmCloud/wash — examples/qrcode - Interfaces: Exports
wasi:http/incoming-handler@0.2.2
Go
Requires Go 1.23+, TinyGo (latest), and wasm-tools v1.225.0. See Quickstart prerequisites for setup instructions.
HTTP Hello World (Go)
A simple HTTP server built in Go using github.com/julienschmidt/httprouter for routing and the go.wasmcloud.dev/component SDK for wasmCloud integration.
- Source:
wasmCloud/wash — examples/go-hello-world - Interfaces: Exports
wasi:http/incoming-handler@0.2.0