Wasmrun
Wasmrun is a powerful WebAssembly (WASM) runtime CLI tool with full WASI support and modular plugin architecture.
✨ Features
- 🚀 Instant Development Server - Point Wasmrun to your .wasm file or project and get a ready playground in your browser
- 🌐 Browser Integration - Automatically opens your default browser with interactive console and debugging tools
- 💻 Interactive Console - View execution results and logs in a beautiful web interface
- 🔍 Smart Detection - Automatically identifies entry points and module types (standard WASM vs wasm-bindgen)
- 🔌 Plugin Architecture - Modular language support through a flexible plugin system
- 📦 Multi-Language Support - Built-in plugins for Rust, Go, C/C++, AssemblyScript, and Python
- 🔧 Built-in Compilation - Integrated build system with plugin-based compilation
- 🔍 WASM Inspection - Verify and analyze WASM files with detailed module information and binary analysis
- 👀 Live Reload - Watch mode for automatic recompilation and browser refresh during development
- 🌟 Full WASI Support - Complete WebAssembly System Interface implementation with virtual filesystem
- 🌐 Web Application Support - Experimental support for Rust web frameworks (Yew, Leptos, Dioxus, etc.)
- ⚡ Zero Configuration - Works out of the box with sensible defaults and automatic project detection
🚀 Installation
From Cargo (Recommended)
From Source
📖 Usage
Wasmrun supports both flag-based arguments using --path
and direct positional arguments for an intuitive command line experience.
Quick Start
# Run on current directory
# Run a WebAssembly file directly
# Run a project directory
# With flags
🔧 Commands
Development Server
Start the development server with live reload:
Compilation
Compile a project to WebAssembly using the appropriate plugin:
Plugin Management
List available plugins and check dependencies:
# List all available plugins
# Get detailed plugin information
Verification & Inspection
Verify a WASM file format and analyze structure:
Project Management
Initialize a new project:
Clean build artifacts:
Server Control
Stop any running Wasmrun server:
🔌 Plugin Architecture
Wasmrun uses a modular plugin system where each programming language is supported through dedicated plugins. This architecture provides:
- Extensibility - Easy to add new language support
- Maintainability - Each plugin is self-contained
- Consistency - Unified interface across all languages
- Flexibility - Plugin-specific optimizations and features
Built-in Plugins
Plugin | Status | Compiler/Runtime | Capabilities |
---|---|---|---|
✅ Full Support | cargo + rustc |
Standard WASM, wasm-bindgen, web apps, optimization | |
✅ Full Support | emscripten |
Complete toolchain, Makefile support | |
✅ Full Support | asc + npm/yarn |
TypeScript-like syntax, optimization | |
✅ Beta Support | py2wasm |
Runtime integration, bundle creation |
External Plugins
Plugin | Status | Source | Capabilities |
---|---|---|---|
✅ Full Support | wasmgo | tinygo compiler, optimization |
Plugin Capabilities
Each plugin provides specific capabilities:
Feature | Rust | Go | C/C++ | AssemblyScript | Python |
---|---|---|---|---|---|
Compile to WASM | ✅ | ✅ | ✅ | ✅ | ✅ |
Web Applications | ✅ | ❌ | ✅ | ❌ | ✅ |
Live Reload | ✅ | ✅ | ✅ | ✅ | ❌ |
Optimization | ✅ | ✅ | ✅ | ✅ | ❌ |
Custom Targets | Multiple | wasm | web | wasm | TBD |
Web Frameworks (Rust Plugin)
The Rust plugin automatically detects and supports web frameworks with specialized web application mode:
- Yew - Modern Rust / Wasm framework
- Leptos - Full-stack, compile-time optimal Rust framework
- Dioxus - Cross-platform GUI library
- Sycamore - Reactive library
- Trunk - Build tool for Rust-generated WebAssembly
Web framework support is highly experimental and actively being improved. Looking for contributors. 👋
🌟 How It Works
Plugin-Based Compilation
- Project Detection - Wasmrun analyzes the project and selects the appropriate plugin
- Dependency Verification - The plugin checks for required tools and dependencies
- Compilation - Plugin-specific build process with optimizations
- Output Generation - WASM file creation with plugin-specific features
For WASM Files
- Wasmrun server with WASI support starts running
- Opens your default browser with an interactive interface
- Serves the WASM file with comprehensive WASI support including virtual filesystem
- Provides real-time console output, debugging tools, and file system interaction
For Projects
- Plugin Selection - Automatically identifies and loads the appropriate language plugin
- Dependency Checking - Plugin verifies required tools are installed
- Compilation - Plugin builds optimized WASM with proper flags and optimizations
- Serving - Runs development server with live reload
- Framework Detection - Special handling for web applications (Rust plugin)
🔍 WASI Support
Wasmrun intends to provide support for complete WebAssembly System Interface (WASI) implementation in the browser. It's a work in progress. Some features might work, but it's highly experimental.
🎯 Use Cases
Development & Testing
# Quick WASM testing with instant feedback
# Project development with live reload (plugin auto-detected)
# Build and optimize for production (plugin-specific optimizations)
Plugin Management
# List available plugins and their capabilities
# Get detailed information about a specific plugin
Learning & Education
# Inspect WASM structure and understand internals
# Verify WASM compliance and format
# See which plugin would handle a project
Web Application Development
# Rust web app with hot reload (Rust plugin auto-detects frameworks)
# Multi-framework support
# Python web app with Pyodide
Performance Analysis
# Size-optimized builds with plugin-specific optimizations
# Debug builds with full symbols
# Compare different plugin optimizations
🔧 Configuration
Environment Variables
WASMRUN_PORT
- Default server port (default: 8420)WASMRUN_WATCH
- Enable watch mode by defaultWASMRUN_OUTPUT
- Default output directory for buildsWASMRUN_DEBUG
- Enable debug outputRUST_BACKTRACE
- Show stack traces for errors
Plugin Detection
Wasmrun automatically selects plugins based on project structure:
- Rust Plugin:
Cargo.toml
present - Go Plugin:
go.mod
or.go
files present - C/C++ Plugin:
.c
,.cpp
,.h
files, orMakefile
present - AssemblyScript Plugin:
package.json
with AssemblyScript dependency orassembly/
directory - Python Plugin:
.py
files orrequirements.txt
present
Optimization Levels
Plugin-specific optimization levels:
debug
- Fast compilation, full symbols, no optimizationrelease
- Optimized for performance (default)size
- Optimized for minimal file size (plugin-dependent implementation)
🔍 Troubleshooting
Plugin-Related Issues
"No plugin found for project"
# Check what files are in your project
# Ensure proper entry files exist (Cargo.toml, go.mod, etc.)
# Use wasmrun plugin list to see available plugins
🚨 Open an issue and let us know about it.
"Plugin dependencies missing"
# Install missing tools for specific plugins:
# Install emcc for C/C++ plugin
# Install tinygo for Go plugin
# Install asc for AssemblyScript plugin
"Wrong plugin selected"
# Force a specific plugin
Configuring py2wasm
- Make sure that you have python3.11.0 is installed and configured. We recommend
using mise.
- Now install py2wasm, you can use a virtual environment or not.
- Make sure that you have named the entry file as main.py or app.py.
Common Issues
"Port is already in use"
"No entry point found"
- Ensure your WASM has
main()
,_start()
, or exported functions - Use
wasmrun inspect
to see available exports - Check plugin-specific entry file requirements
"wasm-bindgen module detected"
- Use the
.js
file instead of the.wasm
file directly (Rust plugin) - Run
wasmrun project-dir
instead of individual files
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines, including how to add new plugins and extend existing ones.
Adding New Plugins
The modular architecture makes it easy to add support for new languages. See the plugin development guide for details.
📄 License
🙏 Credits
Wasmrun is built with love using:
- tiny_http - Lightweight HTTP server
- clap - Command line argument parsing
- notify - File system watching for live reload
- wasm-bindgen - Web integration
- Font used for logo is Pixeled by OmegaPC777.
- And the amazing Rust and WebAssembly communities ❤️
Made with ❤️ for the WebAssembly community
⭐ If you find Wasmrun useful, please consider starring the repository!