To support the full cargo tangle blueprint create --name my_project workflow—including smart contract deployment with Forge/Soldeer and compiling Tangle Blueprint Rust projects—all within a browser-based IDE, you’ll need a hybrid architecture that merges:
- WASM-based toolchains for Rust and Solidity
- Filesystem + container abstraction (via WASI, VFS, and maybe container2wasm or web-container)
- Persistent user workspace and streaming build logs/output
You can support Blueprint compilation by integrating:
✅ Option A: wasm-cargo or rustc-wasm
- Compile a restricted subset of Rust to WASM via
wasm32-wasiorwasm32-unknown-unknown - Use
webcontainer(from StackBlitz) to simulate the workspace and runcargoinside the browser with WASI syscalls. - Track toolchains with
wasmer/wapmor precompile toolchains into your WASM bundle
- Run
cargo build,forge build, etc. in an ephemeral environment on your infra. - Stream logs via WebSocket to your IDE.
- More reliable for full native builds including networking, Tangle SDK, etc.
🔄 Combine both: WASM for lightweight in-browser validation, backend for heavy builds (configurable per user/project)
Forge and Soldeer are written in Rust and can be compiled to WASM.
- Compile
foundry(includesforge) to WASM usingcargo build --target=wasm32-wasi - Package with
wasmer-jsorwebcontainerfor browser FS access - OR run forge in Docker-in-browser using:
⛔️ Limitations:
solcandforgerequire syscalls and networking. Might be better to use your own WASMified Solc (like used in Remix IDE), or run it remotely.
You have 3 paths to make this real:
- Converts Docker containers to WASM modules using WASI
- Can sandbox the container for web execution
- Requires a WASM runtime in-browser (e.g.,
wasmer-js,wasmtime-py, orjco)
- Run WASM-compiled binaries (like Rust/C/C++/Forge) with WASI support in-browser
- Supports WASIX: fork/exec, TCP, pipes
- Entire browser-based Linux+Node environment
- Could build a Forge+Cargo pre-bundle in this
- Monaco-based editor with split panes
- Project Explorer: detect
*-bin,*-lib, andcontracts - Tabs: code / build logs / contract ABIs / deployed addresses
- "Run" button that builds project and deploys test instance locally
- Workerized sandbox using
wasm-cargoorwebcontainerruntime - API to trigger full
cargo tangle blueprint create+cargo build+forge build - Save compiled artifacts and contract deployments
graph TD
A[User: Clicks "New Blueprint"] --> B[cargo tangle blueprint create]
B --> C[Creates folders + contracts + lib/bin crates]
C --> D[User edits code in Monaco IDE]
D --> E1[Build Rust via cargo WASM / backend]
D --> E2[Compile & deploy contracts via Forge WASM / backend]
E1 --> F[Show Rust build output]
E2 --> G[Show contract address / ABI]
F --> H[Stream build status + diagnostics to user]
- Multi-tenant ephemeral backends: Use something like Railway/Firecracker to execute user jobs securely.
- Streaming compiler logs: Use @webcontainer/log-streaming or WebSocket log relays.
- Custom Forge-in-WASM build: Fork
foundryand trim non-essential features to compile it more easily to WASM.
Would you like a working prototype scaffold of the IDE code with WebContainer + Monaco + Cargo support + contract deploy UI?