A WebAssembly actor runtime for reproducible, isolated, and observable programs.
Theater runs WebAssembly components as actors with complete traceability - every interaction crossing the sandbox boundary is captured in an event chain. This enables debugging, replay, and verification of program execution.
- Actor Model: Erlang-style actors with supervision hierarchies for fault tolerance
- Event Chain: Every host call is recorded, enabling deterministic replay and debugging
- WebAssembly Isolation: Actors run in sandboxed WASM components with explicit capabilities
- Pack Runtime: Uses Pack for Graph ABI-based WASM execution
- Handler System: Modular capabilities (runtime, messaging, storage, supervision)
- Nix with flakes enabled (recommended)
- Or: Rust 1.83.0+, with
wasm32-unknown-unknownandwasm32-wasip1targets
git clone https://github.com/colinrozzi/theater.git
cd theater
nix develop
cargo buildgit clone https://github.com/colinrozzi/theater.git
cd theater
# Install WASM targets
rustup target add wasm32-unknown-unknown wasm32-wasip1
# Build (requires Pack to be available at ../pack)
cargo buildUse the CLI to scaffold a new actor:
# Create a new actor project
theater new my-actor
cd my-actor
theater build
theater runActors implement the theater:simple/actor interface:
use bindings::exports::theater::simple::actor::Guest;
use bindings::theater::simple::runtime::log;
struct Component;
impl Guest for Component {
fn init(state: Option<Vec<u8>>, params: (String,)) -> Result<(Option<Vec<u8>>,), String> {
log("Actor initialized!");
Ok((state,))
}
}┌─────────────────────────────────────────────────┐
│ TheaterRuntime │
│ ┌───────────────────────────────────────────┐ │
│ │ ActorRuntime │ │
│ │ ┌─────────────────────────────────────┐ │ │
│ │ │ PackInstance (WASM) │ │ │
│ │ │ │ │ │
│ │ │ Actor Code + State │ │ │
│ │ └─────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────┴─────┐ │ │
│ │ │ Handlers │ │ │
│ │ └───────────┘ │ │
│ │ runtime│message│store│supervisor │ │
│ └───────────────────────────────────────────┘ │
│ │ │
│ Event Chain │
└─────────────────────────────────────────────────┘
Handlers provide capabilities to actors:
| Handler | Description |
|---|---|
runtime |
Logging, shutdown, event chain access |
message-server |
Actor-to-actor messaging |
store |
Content-addressed storage |
supervisor |
Spawn and manage child actors |
Theater is in active development. The API is stabilizing but breaking changes may occur.
Contributions welcome! Please open an issue to discuss significant changes before submitting PRs.
Apache-2.0