liveBook · Manning

Wasmcloud.toml

As explained in Server-Side WebAssembly

wasmcloud.toml is a wasmCloud manifest file that declares component metadata, interfaces, and compilation settings.

wasmcloud.toml is the component manifest: a small declaration that identifies a wasmCloud component and connects its interface world to its Wasm build target. It keeps component-level build metadata separate from application deployment topology, which is described in wadm.yaml. section 6.1 section 6.6

Listing 6.2 hello-world-wasmcloud’s wasmcloud.toml file
name = "http-hello-world"
version = "0.1.0"
language = "rust"
type = "component"

[component]
wit_world = "hello"
wasm_target = "wasm32-wasip2"

A minimal HTTP component manifest names a Rust component, declares it as a component, selects the hello WIT world, and targets wasm32-wasip2. section 6.1

A manifest shown here declares:

  • Identity metadata: name, version, language, and type. section 6.1
  • The WIT world implemented by the component through component.wit_world. section 6.1
  • The Wasm compilation target through component.wasm_target; wasm32-wasip2 corresponds to WASI 0.2. section 6.1

The WIT world is the interface contract, while wasmcloud.toml selects that world for compilation. For an HTTP component, the selected world exports the WASI HTTP incoming-handler interface; deployment then links that interface to an HTTP server capability in wadm.yaml. section 6.1 section 6.1

Renaming a component for SmartCMS

After creating a Rust component from the Hello World template, set name to "smart-cms" and point wit_world to "backend". The target remains wasm32-wasip2, while Cargo.toml is updated separately to use the SmartCMS package name. section 6.6 section 6.6

Listing 6.15 Updated application name in wasmcloud.toml
name = "smart-cms"
version = "0.1.0"
language = "rust"
type = "component"

[component]
wit_world = "backend" #1
wasm_target = "wasm32-wasip2"

The SmartCMS manifest shows the same component metadata and WASI 0.2 target with a project-specific name and WIT world. section 6.6

How Server-Side WebAssembly covers it

How deep it goes
Explains manifest fields through Hello World and SmartCMS listings, while leaving deployment configuration to wadm.yaml.
Examples
Uses HTTP Hello World and SmartCMS manifests, selecting the hello and backend WIT worlds.
What it assumes
Assumes a Rust component template and WIT world, while identifying the required wasm32-wasip2 compilation target.
What you can do after
Operate/configure it by naming a component, selecting its WIT world, and setting its Wasm target.
How it connects
Connects WIT worlds, WASI HTTP incoming-handler, wasm32-wasip2, Cargo.toml, and wadm.yaml.

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.