Skip to main content
Version: v2

Templates & Examples

Get started building components for wasmCloud.

  • Templates are scaffolds for new applications. Use wash new to create a project from a template, then customize it for your use case.
  • Examples are complete applications demonstrating specific wasmCloud capabilities.
Compatibility

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

TemplateLanguageDescription
HTTP Hello WorldRustHTTP server using wstd
TCP ServiceRustHTTP API + TCP service workspace
HTTP Hello World (Hono)TypeScriptHTTP server using Hono
HTTP Hello World (Fetch API)TypeScriptHTTP server using the Fetch API
HTTP ClientTypeScriptOutgoing HTTP proxy
HTTP Service (Hono)TypeScriptFull REST API service
HTTP Service with Blob Storage (Hono)TypeScriptREST API + wasi:blobstore
HTTP Service with Filesystem (Hono)TypeScriptREST API + wasi:filesystem
HTTP Service with Key-Value Storage (Hono)TypeScriptREST API + wasi:keyvalue
HTTP API with Distributed WorkloadsTypeScriptTwo components coordinating via wasmcloud:messaging
TCP Echo ServiceTypeScriptHTTP component + TCP service workload

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.

Create from template:

shell
wash new https://github.com/wasmCloud/wasmCloud.git --name my-project --subfolder templates/http-hello-world

TCP 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 worldh3110 w0r1d). Together they demonstrate a multi-component service pattern with TCP transport.

Create from template:

shell
wash new https://github.com/wasmCloud/wasmCloud.git --name my-service --subfolder templates/service-tcp

TypeScript

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.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-hello-world-hono

HTTP Hello World (Fetch API)

A minimal HTTP server component using the Service Worker Fetch API pattern.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-hello-world-fetch

HTTP 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.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-client

HTTP 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.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-service-hono

HTTP 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.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-blobstore-service-hono

HTTP Service with Filesystem (Hono)

An HTTP service component using Hono that serves files from a mounted directory via wasi:filesystem. Demonstrates reading from a preopened host directory inside a Wasm component.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-filesystem-service-hono

HTTP 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.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-kv-service-hono

HTTP API with Distributed Workloads

A two-component TypeScript project demonstrating component-to-component coordination over wasmcloud:messaging. An http-api component accepts POST /task requests and dispatches work via wasmcloud:messaging/consumer; a task-worker component exports wasmcloud:messaging/handler, processes the payload, and returns a reply. During wash dev, the runtime routes calls between components in-process — no NATS server required.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/http-api-with-distributed-workloads

TCP Echo Service

A two-workload TypeScript project demonstrating the wasmCloud service model. A TCP service workload accepts connections on 127.0.0.1:7878, reads lines, and replies with the word count. A component workload exposes POST /count, forwards text to the TCP service over the in-process loopback network, and returns a JSON response.

Create from template:

shell
wash new https://github.com/wasmCloud/typescript.git --name my-project --subfolder templates/service-tcp-echo

Examples

Complete example applications are available in the examples/ directory of wasmCloud/wasmCloud. Run wash dev from any example directory to build and start a local development environment.

ExampleLanguageOCI Artifact
HTTP Hello World (Rust)Rustghcr.io/wasmcloud/components/hello-world
BlobbyRustghcr.io/wasmcloud/components/blobby-ui
QR Code GeneratorRust
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.

Blobby

A file server component ("Little Blobby Tables") demonstrating CRUD operations on blob storage, served through a web UI.

QR Code Generator

A QR code generator that accepts text input via HTTP and returns a PNG-encoded QR code, with a web UI.

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.