Real Rust, in the browser tab
Stock rustc and cargo compile unmodified Rust source for BrowserPod. Programs keep the standard library: they read and write files, make network requests, start subprocesses and run threads in parallel.
1# Install the BrowserPod Rust toolchain 2$ curl https://rt.browserpod.io/4.0.0/rust/install.sh \ 3 | bash 4$ rustup override set browserpod-4.0.0 5 6# The program in the pod below 7$ cat src/main.rs 8use std::{env, thread}; 9 10fn main() { 11 let who = env::args().nth(1); 12 let who = who.as_deref().unwrap_or("BrowserPod"); 13 let t = thread::spawn(|| "a real thread"); 14 println!("Hello, {who}, from {} π", t.join().unwrap()); 15} 16 17# Build it for the pod 18$ cargo build --release \ 19 --target wasm32-browserpod-linux-musl
From cargo to a running pod
You need rustup on your machine. The install script adds a pinned nightly toolchain with the BrowserPod target.
-
1Install the toolchain
Download and install the BrowserPod Rust toolchain.
$ curl https://rt.browserpod.io/4.0.0/rust/install.sh | bash -
2Set the override
Point the project at the toolchain, or set the channel in rust-toolchain.toml.
$ rustup override set browserpod-4.0.0 -
3Build
The binary lands in target/wasm32-browserpod-linux-musl/release.
$ cargo build --release \ --target wasm32-browserpod-linux-musl -
4Run it in a pod
Copy the binary into the pod, then start bash and run it.
pod.run("bash", [], { terminal })
Copy it in and run it
Your web app serves the binary. The page copies it into the pod and opens bash, so the user can run it and keep going.
1import { BrowserPod } from "@leaningtech/browserpod"; 2 3const pod = await BrowserPod.boot(); 4const el = document.getElementById("console"); 5const terminal = await pod.createDefaultTerminal(el); 6 7// Copy the binary into the pod 8const file = await pod.createFile("/hello", "binary"); 9const resp = await fetch("/hello"); 10await file.write(await resp.arrayBuffer()); 11await file.close(); 12 13await pod.run("bash", [], { terminal });
Smaller binaries
Add a profile to Cargo.toml with link-time optimisation and
size-first settings, then build with --profile release-small.
On macOS, install LLVM with Homebrew if your project has C dependencies, so clang can target WebAssembly.
1[profile.release-small] 2inherits = "release" 3lto = true 4codegen-units = 1 5opt-level = "z" 6strip = true
Real Rust projects, unchanged
These projects build for BrowserPod from their own source, from ripgrep at around 40,000 lines to Codex at over a million.
Other runtimes
One API boots a pod, opens a terminal and runs a program, whichever language it is written in.
Get started
Install BrowserPod from npm and boot your first pod.
$npm i @leaningtech/browserpod Need public URLs, GitHub or TCP from a pod? Add an API key for BrowserPod Edge, free for 1,000 hours a month.Get an API key










