Rust compiler that runs in the browser!
See the codeRubrc runs a WebAssembly-hosted Rust toolchain directly inside a browser worker.
Note: This project is under active pre-release development (v2.0). Some package metadata may still report older versions. It is a work in progress and is not yet ready for general production use. See
RELEASE.mdand the issue tracker for the current status.
Live Demo: Rubrc (v1 is available at Rubrc v1)
[!WARNING] This project requires
Cross-Origin-Opener-Policy(COOP) andCross-Origin-Embedder-Policy(COEP) headers to function correctly. You must run it on a properly configured server.
rustc, Cargo, clang, and llvm directly inside the browser.rust-analyzer language server for LSP functionality and diagnostics. Changes in the editor are synchronized into the virtual filesystem at /src/main.rs.xterm.js terminal supporting pipes, multiple sessions, panels, and terminal paste support (Ctrl+V).download command to extract files from the VFS to your local machine, and supports dynamic target sysroot loading.Executable files can currently be generated for the following tested targets:
wasm32-wasip1x86_64-unknown-linux-muslNote: Other targets are known to fail during the linking process.
rustc main.rs (Note: the embedded rustc command automatically appends --sysroot /sysroot unless explicitly provided).cargo buildclang file.cdownload /path/to/file (Downloads a file from Rubrc's virtual filesystem to the browser. Directory downloads are not currently supported.)Rubrc runs a WebAssembly-hosted Rust toolchain inside a browser worker. The frontend is a SolidJS application containing a Monaco-based Rust editor and xterm.js terminal interface.
The browser UI communicates with the worker through generated VFS bindings, SharedObject-based proxies, and an LSP transport. Browser-specific operations, including file downloads and additional sysroot loading, are handled through a narrow host bridge (e.g., call_unknown_fn).
The backend runtime is assembled with wasi_virt_layer from several embedded Wasm modules:
vfs: Tool dispatch, virtual filesystem integration, module memory access, and browser host bridging.vfs-shell: Terminal sessions, shell parsing, pipes, and common shell commands.rustc_opt, cargo_opt, llvm_opt, and lsp_opt (rust-analyzer).These modules are invoked directly by the VFS runtime instead of being launched as ordinary OS subprocesses. They retain separate Wasm memory spaces where required, and module boundaries use scalar arguments and explicit memory copies.
CARGO_RUN_LOCK and RUSTC_RUN_LOCK).Prerequisites:
wasi_virt_layer CLI installed.node environment.llvm_opt.wasm, rustc_opt.wasm, lsp_opt.wasm, cargo_opt.wasm) present in crates/vfs/.bun install
bun run vfs:build
bun run build # Development build (includes debug logging)
bun run build:prod # Production build
The core projects that this project depends on are all maintained by me (the author), including browser_wasi_shim-threads, rust_wasm, shared-object, and toolchain-for-building-rustc. I enabled the LLVM backend for rustc, and ultimately, I aim to make rustc executable in browsers that support WASM and allow cargo to run seamlessly on the web.
If you like or want to use this series of projects, I would appreciate it if you could contribute financially via the sponsor button or Buy Me a Coffee:
This project is licensed under the MIT OR Apache-2.0 License.
235 commits
1 commits
TypeScript
36.9%
JavaScript
32.0%
Rust
30.7%
Rust compiler that runs in the browser!
See the codeRubrc runs a WebAssembly-hosted Rust toolchain directly inside a browser worker.
Note: This project is under active pre-release development (v2.0). Some package metadata may still report older versions. It is a work in progress and is not yet ready for general production use. See
RELEASE.mdand the issue tracker for the current status.
Live Demo: Rubrc (v1 is available at Rubrc v1)
[!WARNING] This project requires
Cross-Origin-Opener-Policy(COOP) andCross-Origin-Embedder-Policy(COEP) headers to function correctly. You must run it on a properly configured server.
rustc, Cargo, clang, and llvm directly inside the browser.rust-analyzer language server for LSP functionality and diagnostics. Changes in the editor are synchronized into the virtual filesystem at /src/main.rs.xterm.js terminal supporting pipes, multiple sessions, panels, and terminal paste support (Ctrl+V).download command to extract files from the VFS to your local machine, and supports dynamic target sysroot loading.Executable files can currently be generated for the following tested targets:
wasm32-wasip1x86_64-unknown-linux-muslNote: Other targets are known to fail during the linking process.
rustc main.rs (Note: the embedded rustc command automatically appends --sysroot /sysroot unless explicitly provided).cargo buildclang file.cdownload /path/to/file (Downloads a file from Rubrc's virtual filesystem to the browser. Directory downloads are not currently supported.)Rubrc runs a WebAssembly-hosted Rust toolchain inside a browser worker. The frontend is a SolidJS application containing a Monaco-based Rust editor and xterm.js terminal interface.
The browser UI communicates with the worker through generated VFS bindings, SharedObject-based proxies, and an LSP transport. Browser-specific operations, including file downloads and additional sysroot loading, are handled through a narrow host bridge (e.g., call_unknown_fn).
The backend runtime is assembled with wasi_virt_layer from several embedded Wasm modules:
vfs: Tool dispatch, virtual filesystem integration, module memory access, and browser host bridging.vfs-shell: Terminal sessions, shell parsing, pipes, and common shell commands.rustc_opt, cargo_opt, llvm_opt, and lsp_opt (rust-analyzer).These modules are invoked directly by the VFS runtime instead of being launched as ordinary OS subprocesses. They retain separate Wasm memory spaces where required, and module boundaries use scalar arguments and explicit memory copies.
CARGO_RUN_LOCK and RUSTC_RUN_LOCK).Prerequisites:
wasi_virt_layer CLI installed.node environment.llvm_opt.wasm, rustc_opt.wasm, lsp_opt.wasm, cargo_opt.wasm) present in crates/vfs/.bun install
bun run vfs:build
bun run build # Development build (includes debug logging)
bun run build:prod # Production build
The core projects that this project depends on are all maintained by me (the author), including browser_wasi_shim-threads, rust_wasm, shared-object, and toolchain-for-building-rustc. I enabled the LLVM backend for rustc, and ultimately, I aim to make rustc executable in browsers that support WASM and allow cargo to run seamlessly on the web.
If you like or want to use this series of projects, I would appreciate it if you could contribute financially via the sponsor button or Buy Me a Coffee:
This project is licensed under the MIT OR Apache-2.0 License.
235 commits
1 commits
TypeScript
36.9%
JavaScript
32.0%
Rust
30.7%