Safe streaming pipelines from typed Wasm components.
Torvyn is an ownership-aware reactive runtime built in Rust on the WebAssembly Component Model. Define contracts in WIT, implement in any language, compose pipelines with built-in backpressure and tracing.
Overview
Define typed contracts, compile components to Wasm, and let the host runtime handle scheduling, ownership, and observability.
Why Torvyn
Six engineering properties designed to work together, not bolted on after the fact.
Contract-First Composition
Typed WIT contracts govern every interaction. torvyn link validates compatibility before runtime.
Ownership-Aware Resources
Host-managed buffers with borrow, transfer, and copy semantics. Every byte tracked and accounted for.
Reactive Backpressure
Credit-based demand propagation. No unbounded queues. Block, drop, or rate-limit per stream.
Capability-Based Sandboxing
Deny-all by default. Each Wasm component receives only explicitly granted permissions.
Production Observability
Native OpenTelemetry. Per-flow traces, metrics, copy accounting, and backpressure diagnostics.
Portable Packaging
OCI-compatible artifacts. Same binary runs on cloud, edge, dev, and on-prem environments.
Under the Hood
Two mechanisms that make Torvyn different: explicit buffer ownership tracking and credit-based backpressure propagation.
Define. Implement. Compose. Trace.
A WIT contract specifies the interface. A component implements it. A config wires stages together. The runtime handles everything else.
package torvyn:streaming@0.1.0;
interface types {
resource buffer;
record packet-meta {
trace-id: string,
content-type: string,
timestamp-ns: u64,
}
record stream-element {
meta: packet-meta,
payload: borrow<buffer>,
}
variant process-error {
invalid-input(string),
unavailable(string),
internal(string),
}
}
interface processor {
use types.{stream-element, process-error};
process: func(input: stream-element)
-> result<stream-element, process-error>;
}
-
1
Define contracts
Write a WIT interface specifying inputs, outputs, and error types. This is the source of truth for every component boundary.
-
2
Implement components
Write your domain logic in Rust, C, Go, or any language that compiles to WebAssembly. No runtime boilerplate.
-
3
Compose a pipeline
Wire stages together in TOML. The linker validates all contracts before a single byte flows through the system.
-
4
Run with full observability
Launch with per-stage latency, copy accounting, backpressure metrics, and OpenTelemetry traces — out of the box.
Developer Toolchain
Every stage validates correctness. Contract mismatches, missing capabilities, and cyclic dependencies are caught before runtime — not in production.
.wit contracts specifying typed interfaces, data types, and error variants.*.wittorvyn checktorvyn buildtorvyn linktorvyn runHow Torvyn Compares
Wasm-level isolation without network overhead. Typed contracts at every boundary. Built-in observability.
| Microservices | Containers | In-Process | Torvyn | |
|---|---|---|---|---|
| Isolation | Process | OS | None | Wasm sandbox |
| Contracts | Schema (lax) | None | None | WIT (strict) |
| Boundary cost | ~ms (network) | ~100 µs | ~0 | < 5 µs |
| Polyglot | Yes | Yes | No | Yes (Wasm) |
| Observability | Per-service | External | Manual | Built-in OTel |
| Backpressure | Queue overflow | External | Manual | Credit-based |
Where Torvyn Fits
Same-node pipelines, edge processing, secure plugins, and event-driven architectures.
AI Inference Pipelines
Compose preprocessing, scoring, and delivery as isolated, traced components.
Read more →Edge Processing
Lightweight Wasm pipelines at the edge with minimal footprint.
Read more →Event-Driven
Contract-defined components with typed interfaces and bounded queuing.
Read more →Secure Plugins
Third-party code in sandboxed Wasm with auditable capability grants.
Read more →Get Up and Running
Three commands to a traced, backpressure-aware pipeline.
1. Install
Install the CLI from crates.io.
$ cargo install torvyn
2. Create a project
Scaffold contracts and config.
$ torvyn init my-pipeline
3. Run
Validate, link, and launch.
$ torvyn run --trace
Architecture
13 crates in six build tiers. Strictly acyclic dependency graph enabling maximum parallel compilation.
Build something with Torvyn
We are looking for early adopters. Try it, break it, tell us what worked and what did not.