What is Runno Code Sandbox?
Runno Code Sandbox helps you make runnable code examples that can be embedded in web pages. It uses a WASI (Web Assembly System Interface) runtime to emulate a file system and operating system inside the browser, allowing programs to run without modification. It is primarily designed for programming education, enabling learners to run code without installing complex tools and creators to embed interactive examples without a server.
How to use Runno Code Sandbox?
Install the @runno/runtime npm package, import it in your entrypoint file, and set the HTTP headers Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp to create a cross-origin isolated context. Then use the <runno-run> element with a supported runtime (e.g., runtime="python") and your code as its content. For running WASI binaries directly, use <runno-wasi>.
Key features of Runno Code Sandbox
- Runs code in the browser using WebAssembly and WASI.
- Provides a sandboxed, in-memory file system.
- Supports multiple runtimes: Python, Ruby, QuickJS, SQLite, Clang, Clang++, PHP-CGI.
- Offers both web components (
@runno/runtime) and a headless WASI runtime (@runno/wasi).
- Code executes in a Web Worker with terminal emulation via XTerm.js.
- No server-side execution required—all processing happens on the client.
Use cases of Runno Code Sandbox
- Creating interactive programming tutorials or documentation with live code examples.
- Allowing new programmers to run code without installing compilers or interpreters.
- Testing simple programs for correctness inside a client-side sandbox.
- Embedding runnable code snippets in blog posts or educational websites.
- Compiling and running C/C++ code directly in the browser using Clang runtimes.
Comments