liveBook · Manning

Wash

As explained in Server-Side WebAssembly

wash is the wasmCloud command-line interface for creating projects, managing keys, interacting with OCI registries, and operating wasmCloud applications.

wash is the wasmCloud Shell: a command-line interface for moving from a project skeleton to a running wasmCloud application. It generates projects, manages cryptographic keys, works with OCI-compliant registries, and provides commands for building, starting local infrastructure, deploying applications, and checking deployment status. section 6.1

A practical workflow starts with a component template rather than an empty directory. The generated Rust example includes the project structure needed for wasmCloud, including a WIT world definition, its WASI interface dependencies, a component manifest, and application deployment configuration. Other templates are available for C, Go, Python, and TypeScript. section 6.1

wash new component hello-world-wasmcloud --template-name hello-world-rust

Scaffold a wasmCloud component from the Rust hello-world template; the command creates the starting project used by the later build and deployment steps. section 6.1

Use wash to carry a small HTTP component through its local lifecycle:

  • Install the CLI, then create a component project from a selected template. section 6.1
  • Start the local wasmCloud environment in the background with `wash up -d`; it starts NATS and wadm and reports where host logs are written. section 6.1
  • Build the component with `wash build`, producing Wasm artifacts in the build output. section 6.1
  • Deploy the application definition with `wash app deploy ./wadm.yaml`, then inspect deployed applications with `wash app list`. section 6.1
  • Extend an application with a custom capability provider by scaffolding one with `wash new provider <provider-name>` or a language-specific provider template. section 9.1

Deploying an HTTP hello-world component

Create `hello-world-wasmcloud` from the Rust template, add the `wasm32-wasip2` compilation target, and implement the exported `wasi:http/incoming-handler`. Its `wasmcloud.toml` identifies a Rust component and WIT world targeting WASI 0.2. After `wash up -d` and `wash build`, deploy `wadm.yaml`. That application connects the component to the HTTP server capability at `127.0.0.1:8000`; a request returns `Hello from Rust!`. section 6.1

The deployment definition separates the application component from its HTTP capability. A spreadscaler requests one component instance, while a link connects the HTTP server’s `wasi:http` incoming-handler interface to that component. This lets the command-line workflow deploy an application description instead of requiring a custom host. section 6.1

For broader applications, wash also supports provider-oriented extension: built-in logging or alternative key-value storage can be introduced through capability providers, including a possible Redis-for-NATS storage swap. A wasmCloud host can sit behind an HTTP server while components use providers for storage and machine learning. section 9.1

The demonstrated installation uses `wash-cli` version `^0.37`. Linux and macOS receive the primary support tier; on Windows, using Windows Subsystem for Linux is recommended for these examples. section 6.1

How Server-Side WebAssembly covers it

How deep it goes
Walks through a complete hello-world command sequence but defers registry and key-management procedures.
Examples
Uses a Rust HTTP hello-world component, its `wadm.yaml`, and custom provider scaffolding commands.
What it assumes
Assumes Rust target installation for the shown template while supplying generated component files and configuration.
What you can do after
Operate/configure a local wasmCloud application by scaffolding, building, deploying, listing, and testing an HTTP component.
How it connects
Connects wasmCloud components to WIT, WASI, wadm, NATS, capability providers, OCI registries, and HTTP servers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Server-Side WebAssembly. The section links point to the parts of the book it draws on.