WIT packages, worlds, and WAC linking define modern Wasm composition. This 2026 cheat sheet groups commands, config, and patterns for engineers. Read now.
WIT Packages: The Interface Unit
WIT packages are how the Component Model names and groups interfaces. A package is a namespace for type definitions, resource types, and function signatures that components can import or export. Treat a package as a versioned contract, not as implementation: it describes shapes of data and operations without choosing a language or runtime. When you author WIT, keep each package focused on one domain boundary—I/O, storage, auth, or app-specific APIs—so dependents can depend on what they need without pulling unrelated surface area.
Package structure matters for reuse. Shared types belong in packages that many worlds can import; host-specific or product-specific APIs stay in separate packages. Prefer stable names and explicit ownership of types over ad hoc copies of the same record in multiple files. When two teams share a package, the package is the negotiation point: change the WIT carefully, document breaking vs additive changes, and regenerate bindings on both sides rather than hand-editing glue.
Worlds: What a Component Sees and Offers
A world is the complete import/export surface of a component. Imports declare what the component expects from its host or from other components; exports declare what it provides. The world is the unit of composition: you do not link free-floating functions—you match worlds. A well-designed world is small enough to understand in one reading and complete enough that a component can be tested against a mock host that only implements those imports.
Common patterns: a library-style world that exports pure APIs and imports almost nothing; a service world that imports platform capabilities (clock, filesystem, network) and exports a narrower application API; a guest world used only for tests that stubs heavy dependencies. Avoid mega-worlds that re-export everything a monorepo might need. Prefer composing smaller worlds so each component’s dependency set stays explicit and easy to audit.
WAC Linking: Wiring Components Together
WAC linking is how you turn separately built components into a larger graph. You declare which component’s export satisfies which other component’s import, resolve worlds against each other, and produce a composed artifact. Think in terms of wiring diagrams: each edge is a WIT interface match, not a language-level import. Mismatches surface at link time—missing imports, incompatible types, or unsatisfied worlds—rather than as vague runtime failures after deploy.
Useful workflow: build each component against its declared world, keep intermediate components as first-class artifacts, then run a composition step that produces the final host-facing component. Keep composition config next to the components it wires so the graph is reviewable in pull requests. When a link fails, fix the world or package contract first; only then adjust implementation. That order keeps composition deterministic and debuggable.
Commands, Config, and Day-to-Day Patterns
Engineers typically cycle through the same few moves: define or update WIT packages, generate language bindings, implement against the world, validate the component against its world, then compose with WAC. Store WIT and composition specs in source control; treat generated bindings as build outputs unless your toolchain requires them committed. Pin package identities in config so local and CI builds resolve the same interfaces.
- Start new features from WIT and the world, then generate stubs—do not reverse-engineer interfaces from finished code.
- Keep host capability imports thin; push policy and orchestration into higher-level components you control.
- Compose incrementally: link two components, verify, then add the next edge.
- Document which world is the public host boundary so operators know what must be provided at runtime.
Used this way, packages, worlds, and WAC linking form a single mental model: contracts first, implementations second, composition last. That is the practical core of modern Wasm composition for teams shipping multi-language or multi-team components.