Skip to content

Repository files navigation

Wasmrun

WebAssembly

Crates.io Version Crates.io Downloads Crates.io Downloads (latest version) Open Source Contributors maintenance-status License: MIT

Wasmrun is a powerful WebAssembly runtime that simplifies development, compilation, and deployment of WebAssembly applications.

Banner

✨ Features

  • 🚀 Multi-Language Support - Rust, Go, Python, C/C++, and AssemblyScript
  • 🔌 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 for WASM and web apps
  • 📦 Smart Project Detection - Automatically detects and configures project types
  • 🏃 Native WASM Execution - Run WASM files directly with argument passing
  • 🤖 Agent Sandboxes - A REST API that gives AI agents isolated environments to run code in, without Docker

📚 Documentation

📖 Full Documentation

🚀 Quick Start

Installation

cargo install wasmrun

On Arch Linux, install from the AUR (community-maintained):

yay -S wasmrun-bin

For other installation methods (DEB, RPM, from source), see the Installation Guide.

Basic Usage

# Run a WASM file with dev server
wasmrun myfile.wasm

# Run a project directory
wasmrun ./my-wasm-project

# Compile a project
wasmrun compile ./my-project

# Execute WASM natively
wasmrun exec myfile.wasm

# Install language plugins
wasmrun plugin install wasmrust
wasmrun plugin install wasmgo

See the Quick Start Guide for a complete tutorial.

🎛️ Four Modes

Mode Command What it does
Server wasmrun ./my-project Compile and serve a project with a dev server, live reload, and browser-based module inspection
Exec wasmrun exec ./program.wasm Run a WASM file natively through the built-in interpreter with WASI. No browser, no server
Agent wasmrun agent A REST sandbox API for AI agents. No Docker, no daemon
OS wasmrun os ./my-project Browser-based VM with a virtual filesystem and multi-language runtimes

🏃 Exec Mode

Run a .wasm file directly. Arguments after the file go to the program, and --call picks an exported function instead of the entry point:

wasmrun exec ./program.wasm arg1 arg2
wasmrun exec ./math.wasm --call add 2 3

The interpreter implements WASI Preview 1, so file I/O, environment variables, arguments, clocks, and randomness all work.

🤖 Agent Mode

Start a sandbox server for AI agents:

wasmrun agent --port 8430

Create a session, then execute code in it:

SID=$(curl -sX POST http://localhost:8430/api/v1/sessions | jq -r .session_id)

curl -X POST http://localhost:8430/api/v1/sessions/$SID/exec \
  -H 'Content-Type: application/json' \
  -d '{"source": "const _ = require(\"lodash\"); console.log(_.chunk([1,2,3,4], 2));",
       "dependencies": {"lodash": "^4.17.21"}}'
  • JavaScript and TypeScript run from source, with npm dependencies vendored into the sandbox (it has no network of its own) and lockfiles for reproducible installs
  • Pre-compiled .wasm modules run through the same interpreter as exec mode
  • GET /api/v1/tools returns OpenAI/Anthropic-compatible tool schemas, so an LLM can drive the sandbox through function calling
  • Per-session limits on memory, fuel, output, file size, and disk; optional API-key auth with tenant isolation
  • Binds loopback only by default; GET /health and GET /ready are unauthenticated probes for orchestrators
  • Running it for other people: the deployment guide covers the reverse proxy, systemd and container units, sizing, and monitoring

🔌 Plugin System

Wasmrun uses a plugin architecture for language support:

Built-in:

  • C/C++ (Emscripten)

External Plugins:

  • Rust: wasmrun plugin install wasmrust
  • Go: wasmrun plugin install wasmgo
  • Python: wasmrun plugin install waspy
  • AssemblyScript: wasmrun plugin install wasmasc

Learn more in the Plugin Documentation.

🤝 Contributing

We welcome contributions! See our Contributing Guide.

🎤 Community

📄 License

MIT 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!

About

Powerful WASM runtime with debug capabilities

Topics

Resources

Contributing

Stars

48 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages