In brief
WebAssembly beyond the browser is a way to run compiled code in a lightweight, isolated sandbox on a server, on a device, or as a plugin inside another application. A module has no access to files, the network, or environment variables until the host explicitly grants it. WASI describes the interface to the system, and the component model lets you combine modules written in different languages. It works best in plugins, serverless functions, and running third-party code.
What WebAssembly is and why it left the browser
WebAssembly (Wasm) is a binary instruction format for a stack-based virtual machine, designed as a compilation target for languages such as C, C++, Rust, or Go. The WebAssembly 1.0 core specification has been a W3C Recommendation since December 2019. In the browser it lets you run compute-heavy code faster than JavaScript, e.g. in image editing or CAD.
The same features that were needed in the browser turned out to be useful on the server:
- Isolation. A module runs in linear memory it cannot escape from, and it cannot call a system function the host has not made available to it.
- Portability. The same `.wasm` file runs on x86 and ARM, on Linux, Windows, and macOS, as long as a runtime is present.
- Fast start and small size. A module usually starts much faster than a container, because it does not boot an operating system or an entire language environment.
- Many languages. Compilers to Wasm exist for Rust, C/C++, Go, and .NET, among others.
Outside the browser, modules are run by standalone runtimes, e.g. Wasmtime developed by the Bytecode Alliance, as well as WasmEdge and Wasmer.
WASI and the component model
WASI (WebAssembly System Interface) is a set of standard interfaces through which a Wasm module talks to the outside world: it reads files, uses the clock, sends HTTP requests. The key principle is permissions granted explicitly: a program gets access only to the directory or socket the host handed to it. This is the opposite of an ordinary process, which by default sees everything the user is allowed to access.
WASI evolves in releases. The first, labeled 0.1 (Preview 1), described interfaces in the witx language and resembled a simplified POSIX. Release 0.2 is a modular set of interfaces described in the WIT language, tied to the component model. Release 0.3 adds native support for asynchronous operations to the component model (the `stream` and `future` types).
The component model solves a problem that was a nuisance in plain Wasm: modules exchanged only numbers, and passing a string or a structure required manual encoding in memory. A component has an interface described in WIT, with types such as strings, lists, records, and results with an error. As a result, a component written in Rust can call a component in Python or Go without any shared glue code.
An example WIT interface for a plugin that validates an order:
package company:orders;
interface validation {
record line-item { sku: string, quantity: u32 }
check: func(items: list<line-item>) -> result<_, string>;
}
world plugin {
export validation;
}Where WebAssembly beyond the browser makes sense
WebAssembly on the server works best where you need to run someone else's or frequently changing code safely and fast. Typical uses:
| Use case | Why Wasm |
|---|---|
| Plugins in products and platforms | a customer or partner adds logic that cannot damage the host |
| Filters in proxies and API gateways | logic on the request path without rebuilding the whole proxy (e.g. Wasm filters in Envoy) |
| Serverless functions and edge computing | fast start, small overhead per invocation |
| Business rules swapped without a deployment | a module with tariff or validation rules loaded on the fly |
| Devices and industrial gateways | the same module on different processors, isolated from the firmware |
A banking example: a settlement system lets product teams add their own transfer validation rules. Instead of deploying their code in the main process, the platform loads a Wasm component with a clearly described interface and a memory and time limit. An error in a rule ends with the call being rejected, not with a system failure.
A manufacturing example: a gateway at the production line collects data from controllers and preprocesses it. The filtering algorithm, compiled to Wasm, can be updated remotely without replacing the whole gateway software. More about such architectures in the article on edge computing in manufacturing and logistics.
Limits and risks
WebAssembly does not replace containers in every use case. A container will run any application with its file system, libraries, and child processes. A Wasm module will run only code compiled to Wasm that uses the interfaces the host supports.
Limitations worth knowing before you decide:
- Ecosystem maturity. Support for WASI and the component model differs between languages and runtimes. Before choosing, check whether your language and libraries compile to the target WASI release.
- Threads and system operations. Multithreading, direct hardware access, and some system calls are limited or require extensions.
- Compute performance. Wasm code is fast, but usually does not match native code optimized for a specific processor.
- Diagnostic tooling. Debugging, profiling, and observability of modules are less developed than for ordinary processes.
- Isolation is not everything. The sandbox protects the host, but does not check the module's logic. A component from a partner still needs review, versioning, and signing, like any element of the software supply chain.
How to get started
The most sensible approach is to start with one narrow use case, e.g. a plugin or a filter, rather than migrating services out of containers. Steps:
- Describe the interface in WIT: what data goes in, what comes back, which errors are possible.
- Choose a runtime and check which WASI release it supports.
- Set limits: memory, execution time, access to files and the network.
- Build interface contract tests, similar to API contract testing.
- Add the component to the pipeline with a signature and a dependency scan.
B2Bnetwork engineers develop software, integrations, and industrial software in projects for banks, operators, and manufacturers. The scope of services is described in the What we do section.
Questions and answers
Will WebAssembly replace Docker containers?
Not in general. Containers run arbitrary applications with their whole environment, while Wasm runs only code compiled to that format. Wasm wins where fast start, small size, and strong isolation of third-party code matter: in plugins, filters, and serverless functions. The two technologies can work side by side on the same platform.
How does WASI differ from the component model?
WASI is a set of standard interfaces to the outside world: files, the clock, the network, HTTP. The component model is a way to describe and combine modules through typed interfaces in the WIT language. Newer WASI releases are defined in WIT and use the component model, so in practice the two elements appear together.
Which language should I use to write WebAssembly modules for the server?
Rust is the best supported, with good tooling for WASI and the component model. C and C++ also work well. Go, .NET, Python, and JavaScript have compilers or runtimes for Wasm, but the scope of support varies. Before deciding, check in the language documentation which WASI release it supports.
Is a WebAssembly module secure by design?
The Wasm sandbox protects the host: a module will not escape its memory and will not use resources it was not given. It does not protect against faulty logic, malicious operations on the data passed to it, or vulnerabilities in the runtime itself. Modules need to be reviewed, signed, and updated like any other code.