← Back to archive

Repo of the Day

wasmerio/wasmer-sdk: Wasmer SDK: Run anything, anywhere suing WebAssembly-based sandboxes

Published: Sep 3, 2026

Open repository ↗

Wasmer SDK: Run anything, anywhere suing WebAssembly-based sandboxes - wasmerio/wasmer-sdk

Summary

Wasmer SDK lets engineers run real software (Python, PostgreSQL, PHP, Edge.js, Unix tools) inside lightweight WebAssembly sandboxes from JavaScript, Python, Rust, or Swift. The same package, sandbox, command, process, filesystem, and port model is exposed across every language, so teams can embed isolated runtimes without building their own container infrastructure.

What it is useful for

The SDK is useful when an application needs to execute code in an isolated process with controlled files, environment variables, and network access. Concrete examples documented in the README include running Python 3.13, spinning up PostgreSQL 18 and connecting with a standard psql client, hosting a Node.js-compatible HTTP server built on Edge.js, and combining Python, Edge.js, PHP, and shell tools in one sandbox. A separate example renders a PHP website from a browser-side service worker.

Because every execution has an explicit sandbox object, package composition, files, and capabilities stay visible at the call site. .wasmer in the working directory acts as a shared cache: native Rust, Python, and Node.js clients reuse the same registry metadata and downloaded package data, while target-specific compiled artifacts are kept in their own partitions. Set a different cache root when an application needs another location, and do not commit .wasmer to source control.

How engineers can use it

Install the SDK for the language you target. The README documents:

  • JavaScript: npm install @wasmer/sdk
  • Python: pip install wasmer-sdk
  • Rust: workspace or Git, while crate publishing is disabled
  • Swift: SwiftPM, on macOS now and iOS 27+ once an iOS-capable backend is available

The README's JavaScript snippet shows the typical shape:

import { Wasmer } from "@wasmer/sdk/node";
const wasmer = new Wasmer();
const sandbox = await wasmer.sandboxes.create({
  packages: ["python/python@=3.13.20"],
  files: { "hello.py": "print('Hello from Wasmer')" },
});
const output = await sandbox.command("python", ["/workspace/hello.py"]).run();
console.log(output.text());

command(...).run() captures a finite command and fails on a non-zero exit by default; pass check: false (or check=False) when a non-zero status is expected. command(...).spawn() starts a live process with stdin, stdout, stderr, termination, and exit status. sandbox.fs reads and writes the guest filesystem, sandbox.ports waits for guest services, and sandbox.installPackage() adds software after start.

Each SDK ships its own build and test commands in its sub-README, and CI runs the Rust/UniFFI foundation before JavaScript and Python. The SDK is currently alpha, so error codes and less common capabilities may still change, and the Swift preview is macOS-only.