Docs and playgrounds people can run
BrowserPod is a microVM that runs in the browser. Put a real terminal and real runtimes in your docs and playgrounds, so developers run your examples instead of copying them out.
Why runnable examples work
Code samples in docs are usually copied, pasted and run somewhere else, and that's where readers drop off. BrowserPod lets them run the sample in the page, on the real runtime, with the files already in place.
Each reader's pod runs on their own device, so a launch-day spike costs you nothing and never queues. Pods start without downloading a full image.
The library is free for open-source projects and everyone else. When examples need npm, GitHub or an API, open-source projects can apply for a grant for BrowserPod Edge.
What you need to know
Serve the pages that run pods with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp.
If you'd rather not build an embed yet, BrowserCode links and embeds give readers a runnable example today.
What people build
Runnable API references
Every example in the reference runs in place, against the real library.
Step-by-step tutorials
Each step seeds the files it needs, so readers pick up exactly where the text is.
Library playgrounds
Your package installed and an example running on load, ready to edit.
Interactive blog posts
Readers run and change the code in the post instead of cloning a repository.
What your readers get
The real tools, in the page, with nothing to install and nothing for you to host.
-
Embeddable
A pod goes inside the page, next to the explanation it belongs to.
-
Node.js, Rust, git, bash, npm
Examples run on the real Node.js, Rust, git and bash, not an imitation.
-
Runs on the user's device
Every reader's examples run on their own device, so busy days cost you nothing.
-
No concurrency limits
Every reader gets their own pod, however many arrive at once.
-
Loads on demand
Examples start without downloading a whole image.
From snippet to playground
-
Add the package
npm i @leaningtech/browserpod in your docs site.
-
Set two headers
Serve the page cross-origin isolated with COOP and COEP.
-
Seed the files
Write the example's files into the pod when the page loads.
-
Let readers run it
Attach a terminal and let them run, edit and break things safely.
A runnable example
Seed the example into the pod and open a shell in it, right where the reader is.
import { BrowserPod } from "@leaningtech/browserpod";
const pod = await BrowserPod.boot();
const terminal = await pod.createDefaultTerminal(document.querySelector("#example"));
const file = await pod.createFile("/home/user/hello.js", "utf-8");
await file.write(`console.log("Edit me and run node hello.js");`);
await file.close();
await pod.run("bash", [], { terminal, cwd: "/home/user" }); Questions
Is it free for open-source docs?
Yes. The library is free for any use, and open-source projects can apply for a grant for BrowserPod Edge.
Do readers need an account?
No. Pods run in their browser with no sign-up.
Can readers break something?
Only their own pod. Each reader's examples run in their own browser, apart from your site and from every other reader.
Can I link to a runnable example instead of embedding one?
Yes. BrowserCode links and embeds are free and unlimited, so you can point readers at a runnable example without building anything.
Can we self-host BrowserPod?
Yes. Enterprise covers self-hosting the runtime and the network stack, vendoring it into your build and redistributing it in your product.










