+0
Daily
300
stars
64
forks
8
watchers
232
prs
137
issues
10
releases
README
StarlingMonkey
A SpiderMonkey-based JS runtime on WebAssembly
A Bytecode Alliance project
Building
|
Adopters
|
Documentation
|
Chat
StarlingMonkey is a [SpiderMonkey][spidermonkey] based JS runtime optimized for use in [WebAssembly
Components][wasm-component]. StarlingMonkey's core builtins target WASI 0.2.0 to support a Component
Model based event loop and standards-compliant implementations of key web builtins, including the
fetch API, WHATWG Streams, text encoding, and others. To support tailoring for specific use cases,
it's designed to be highly modular, and can be readily extended with custom builtins and host APIs.
StarlingMonkey is used in production for Fastly's JS Compute platform, and Fermyon's Spin JS SDK.
See the ADOPTERS file for more details.
Documentation
For comprehensive documentation, visit our [Documentation Site][gh-pages].
Quick Start
Requirements
The runtime's build is managed by [cmake][cmake], which also takes care of downloading the build
dependencies. To properly manage the Rust toolchain, the build script expects
rustup to be installed in the system.
Usage
With sufficiently new versions of cmake and rustup installed, the build process is as follows:
1. Clone the repo
console
git clone https://github.com/bytecodealliance/StarlingMonkey
cd StarlingMonkey
2. Run the configuration script
For a release configuration, run
console
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
For a debug configuration, run
console
cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
3. Build the runtime
The build system provides two targets for the runtime: starling-raw.wasm and starling.wasm. The former is a raw WebAssembly core module that can be used to build a WebAssembly Component, while the latter is the final componentized runtime that can be used directly with a WebAssembly Component-aware runtime like wasmtime.
A key difference is that starling.wasm can only be used for runtime-evaluation of JavaScript code,
while starling-raw.wasm can be used to build a WebAssembly Component that is specialized for a specific
JavaScript application, and as a result has much faster startup times.
Using StarlingMonkey with dynamically loaded JS code
The following command will build the starling.wasm runtime module in the cmake-build-release
directory:
console
Use cmake-build-debug for the debug build
cmake --build cmake-build-release -t starling --parallel $(nproc)
The resulting runtime can be used to load and evaluate JS code dynamically:
console
wasmtime -S http cmake-build-release/starling.wasm -e "console.log('hello world')"
or, to load a file:
wasmtime -S http --dir . starling.wasm index.js
Creating a specialized runtime for your JS code
To create a specialized version of the runtime, first build a raw, unspecialized core wasm version of StarlingMonkey:
console
Use cmake-build-debug for the debug build
cmake --buildTop issues
#153I want to run a js file that I wrote myself11 comments · 2024-10-10#15Resolving Node.js packages10 comments · 2024-03-20#45Intl support9 comments · 2024-05-09#321WASI incoming HTTP handler can get stuck for JS componets when interleaving (Rust components work)6 comments · 2026-07-03#188Node.js builtins6 comments · 2024-12-10#260Proposal: StarlingMonkey Playground for JS-in-Wasm Components4 comments · 2025-08-06#245Running `meta-dce` build step4 comments · 2025-06-19#239Add native API for reporting an exception4 comments · 2025-04-15
Latest release
starlingmonkey: v0.5.1 starlingmonkey-v0.5.1 2026-11-130.5.1 (2026-11-13) Bug Fixes Internalize CryptoKey metadata on creation (367) (3a94a50) Throw on createDigestAlgorithm returning null in RSA verification (364) (9aba354) Update normalization and copy order in crypto algorithms (366) (82eafe4)