Wasmrun
Wasmrun is a powerful WebAssembly runtime that simplifies development, compilation, and deployment of WebAssembly applications.
✨ Features
- 🚀 Multi-Language Support - Build WebAssembly from Rust, Go, C/C++, AssemblyScript, and Python
- 🔌 Plugin Architecture - Extensible system with built-in and external plugins
- 🔥 Live Reload - Instant development feedback with file watching
- 🌐 Zero-Config Web Server - Built-in HTTP server with WASM and web app hosting
- 📦 Smart Project Detection - Automatically detects and configures project types
- ⚡ 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 manage external plugins:
# List all available plugins
# Install external 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's modular plugin architecture enables seamless integration of different programming languages and compilation toolchains into a unified development experience. Here's a detailed guide on wasmrun plugin architecture.
Plugin Types
1. Built-in Plugins 🔧
Built-in plugins are compiled directly into Wasmrun and provide core language support:
Plugin | Language | Compiler | Status | Capabilities |
---|---|---|---|---|
C/C++ | C, C++ | Emscripten | ✅ Stable | Full WASM + Web Apps + Makefiles |
AssemblyScript | TypeScript-like | asc |
✅ Stable | WASM + Optimization + npm/yarn |
Python | Python | py2wasm |
🚧 Beta | Runtime Integration + Bundle creation |
2. External Plugins 📦
External plugins are distributed via crates.io and installed dynamically to ~/.wasmrun/
:
Plugin | Language | Compiler | Installation | Capabilities |
---|---|---|---|---|
wasmrust | Rust | rustc + wasm-pack |
wasmrun plugin install wasmrust |
Full WASM + Web Apps + Optimization |
wasmgo | Go | TinyGo | wasmrun plugin install wasmgo |
WASM + Optimization + Package Support |
How External Plugins Work:
- 📦 Cargo-like Installation: Similar to
cargo install
, plugins are downloaded and compiled to~/.wasmrun/
- 🔗 Dynamic Loading: Plugins are loaded as shared libraries (FFI) at runtime
- 🎯 Same Interface: External plugins use identical traits as built-in plugins
- 🔧 Auto-detection: Once installed, plugins automatically handle their supported project types
Plugin Management
# Install external plugins (similar to cargo install)
# View all installed plugins
# Get detailed plugin information
# Search for available plugins
# Uninstall plugins
Plugin Installation Process:
- 🔍 Discovery: Searches crates.io for the plugin
- 📦 Download: Uses
cargo install
to build the plugin - 🏠 Storage: Installs to
~/.wasmrun/plugins/{plugin_name}/
- 📋 Registration: Updates wasmrun config with plugin capabilities
- ⚡ Ready: Plugin automatically handles supported projects
🛠️ Language Support
Rust (via External Plugin)
# Install the Rust plugin
# Run Rust projects
Requirements:
- Rust toolchain
wasm32-unknown-unknown
target:rustup target add wasm32-unknown-unknown
- Optional:
wasm-pack
for web applications
Go (via External Plugin)
# Install the Go plugin
# Run Go projects
Requirements:
- TinyGo compiler: https://tinygo.org/
C/C++ (Built-in)
# Works out of the box - no plugin installation needed
Requirements:
- Emscripten SDK: https://emscripten.org/
AssemblyScript (Built-in)
# Works out of the box
Requirements:
- AssemblyScript compiler:
npm install -g assemblyscript
Python (Built-in - Beta)
# Works out of the box
Requirements:
- Python 3.11.0 (recommended to use mise)
- py2wasm:
pip install py2wasm
🔍 Project Detection
Wasmrun automatically detects your project type based on:
- File extensions (
.rs
,.go
,.c
,.cpp
,.py
,.ts
) - Configuration files (
Cargo.toml
,go.mod
,Makefile
,package.json
) - Entry point files (
main.rs
,main.go
,main.c
,main.py
, etc.)
You can override detection with the --language
flag:
🚨 Troubleshooting
Plugin Issues
"Plugin not available"
# For built-in language support:
# For Rust projects, install the external plugin:
# Use wasmrun plugin list to see available plugins
🚨 Open an issue and let us know about it.
"Plugin dependencies missing"
# Install missing tools for external plugins:
# Check plugin dependencies:
"Wrong plugin selected"
# Force a specific plugin
External Plugin Installation
"Plugin not found during installation"
# Make sure you have the correct plugin name
# Check available external plugins
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 (wasmrust plugin) - Run
wasmrun project-dir
instead of individual files
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines, including how to create and maintain plugins.
📄 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!