Wasmer

A fast, secure WebAssembly runtime that runs lightweight containers anywhere — from desktop and cloud to the edge and the browser.

20.9Kstars
984forks
MIT License
Rust

Wasmer is a WebAssembly runtime written in Rust that lets you execute WASM modules as fast, sandboxed “containers” instead of full operating-system containers. It ships as both a standalone CLI (wasmer run) and an embeddable library with official SDKs for Rust, C/C++, Python, Go, PHP, Ruby, JavaScript, C#, Swift, and more, so the same compiled .wasm binary can run identically on Linux, macOS, Windows, or inside a browser tab.

At its core, Wasmer offers three interchangeable compiler backends — Singlepass for near-instant compilation during development, Cranelift as the balanced default, and LLVM for maximum runtime performance — all built behind a shared Compiler trait so callers can pick the right trade-off per workload. On top of that sits WASIX, Wasmer’s own extension of the WebAssembly System Interface that adds POSIX-style threads, sockets, and process primitives, making it possible to run unmodified networked, multi-threaded C, Rust, or Python programs as WebAssembly rather than only simple, single-threaded command-line tools.

The project doubles as a package ecosystem: wasmer.toml manifests and the wasmer.io registry let developers publish and wasmer run WASM packages the way docker run pulls container images, and create-exe/create-obj can cross-compile a module into a standalone native executable with no runtime dependency at all. A companion lib/backend-api crate talks to Wasmer’s hosted registry and “Wasmer Edge” platform for deploying WASM workloads to the edge, but that hosted product is a separate commercial layer — everything in this repository, including every compiler backend and syscall layer, is MIT licensed with no gating.

With over 20,000 GitHub stars, weekly-cadence releases, and a workspace of roughly 35 crates spanning VM internals, compilers, CLI, native bindings, and CI tooling, Wasmer is one of the most mature general-purpose WebAssembly runtimes in the ecosystem.

What You Get

  • A standalone wasmer CLI that runs WASM packages instantly via wasmer run, with no VM or container daemon required
  • Three pluggable compiler backends — Singlepass (fast compile), Cranelift (balanced default), and LLVM (peak performance) — selectable per workload
  • WASIX, a POSIX-style syscall extension adding threads, sockets, and process support so full networked/multi-threaded programs can run as WASM
  • Official embedding SDKs for Rust, C/C++, Python, Go, PHP, Ruby, JavaScript, C#, Swift, and more via lib/api, lib/c-api, and lib/napi
  • A package manifest and registry workflow (wasmer.toml, wasmer.io) for publishing and running versioned WASM packages
  • Ahead-of-time cross-compilation (create-exe, create-obj) to produce standalone native binaries or object files from a WASM module

Common Use Cases

  • Running untrusted third-party plugins inside a sandboxed, capability-restricted environment instead of a full VM or container
  • Embedding a scriptable WASM execution engine inside a larger Rust, Python, Go, or JavaScript application
  • Deploying lightweight, instant-cold-start WASM workloads at the edge in place of heavier OCI containers
  • Cross-compiling a single WASM binary that runs identically across Linux, macOS, Windows, and the browser
  • Sandboxing legacy or third-party native code by compiling it to WASM with WASIX for POSIX-like compatibility

Under The Hood

Architecture The workspace is organized as a large, layered set of single-purpose crates rather than one monolith. lib/vm provides the low-level runtime primitives (instances, memory, tables, traps); lib/compiler defines a shared Compiler trait implemented independently by the compiler-singlepass, compiler-cranelift, and compiler-llvm crates, so codegen strategy is swappable without touching the VM. lib/api is the public embedding surface, and it in turn abstracts over three interchangeable execution backends under lib/api/src/backendsys (native), js (browser via wasm-bindgen), and v8 — so the same embedding code can target very different runtime environments. lib/wasix layers a POSIX-like syscall and runtime environment (filesystem, networking, HTTP, process/journal, runners) on top of the core VM to support full applications beyond simple WASI scripts, and lib/cli composes everything into the wasmer binary alongside lib/backend-api, a typed client for Wasmer’s hosted registry and Edge platform. This separation means the Compiler trait and the VM’s instance/memory model are the highest-leverage abstractions — changing either ripples through every compiler backend, every execution backend, and the CLI.

Tech Stack Wasmer is a Rust workspace (2024 edition, pinned via rust-toolchain.toml) of roughly three dozen crates. It parses WebAssembly with wasmparser and compiles it via the pluggable Cranelift, LLVM, and Singlepass backends; tokio’s multi-threaded runtime powers the async networking and HTTP support inside WASIX; wasm-bindgen backs the browser-targeted js execution backend; and native language bindings are generated through lib/napi (Node.js), lib/c-api (C/C++ wasm.h/wasm.hh headers), and lib/swift. The project builds with Cargo and a large Makefile, with a Nix flake (flake.nix/flake.lock) available for reproducible toolchains, and it distributes through an install script, Homebrew, Scoop, Chocolatey, and cargo install.

Code Quality The repository carries an extensive, multi-layered test suite — dedicated integration, compiler, WASI, and official WebAssembly spec (.wast) test trees — run through cargo nextest in CI. Core crates such as lib/api and lib/compiler enforce #![deny(missing_docs)] and a strict set of clippy lint warnings, meaning public APIs must carry documentation and pass style linting to merge. A dedicated lint CI job runs rustfmt and clippy, a deny.toml governs dependency and license auditing, and a typo-checking CI job runs against the whole tree. lib/compiler also supports a no_std/core split for embedded targets, indicating deliberate attention to portability. Overall this reads as a heavily tested, strictly linted, CI-gated codebase typical of infrastructure-grade Rust projects.

What Makes It Unique The standout differentiator is WASIX — Wasmer’s own superset of WASI that adds POSIX-style threads, sockets, and process primitives (visible in lib/wasix/src/net, http, os, and runners), letting unmodified networked or multi-threaded C, Rust, or Python programs run as WebAssembly where plain WASI supports only simple, single-threaded command-line tools. Combined with a genuinely pluggable design on two axes — three interchangeable compiler backends and three interchangeable execution backends behind one embedding API — plus a package-registry-and-Edge model that treats WASM modules as deployable, container-like artifacts, Wasmer occupies a distinctive position among general-purpose WebAssembly runtimes rather than simply reimplementing the WASM spec.

Self-Hosting

Licensing Model MIT licensed — all runtime, compiler, WASIX, CLI, and SDK code in this repository is fully open with no license keys or feature gating for self-hosted or embedded use.

Self-Hosting Restrictions None found. No ee/, enterprise/, or pro/ directories exist in the repository, and no license-check or feature-flag gating (requiresLicense, isPro, isEnterprise) was found in the source.

Enterprise Features Not applicable — there is no paid tier gating functionality within this codebase.

Cloud vs Self-Hosted Wasmer Inc. separately operates a hosted package registry and “Wasmer Edge” deployment platform (wasmer.io) for publishing and running WASM packages in the cloud, and lib/backend-api is the client used to talk to it. That hosted service is a distinct commercial product outside this repository; the runtime itself is identical whether self-hosted or used against the hosted registry.

License Key Required No — the runtime, CLI, and all compiler backends run fully self-hosted with no license key of any kind.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search