boa
Boa is an embeddable Javascript engine written in Rust.
A JavaScript engine written in Rust that lets you embed and run JavaScript code inside any Rust program, without needing a browser or Node.js.
Boa is a JavaScript engine written in Rust. Its purpose is to read and run JavaScript code from within a Rust program, without needing a browser or Node.js. You add the engine as a dependency to your Rust project, pass it a string of JavaScript, and it executes that code and returns the result. This makes it useful for embedding scripting capabilities into desktop applications, command-line tools, or any Rust program that needs to evaluate user-provided JavaScript at runtime.
The engine currently supports more than 90% of the modern ECMAScript specification, which is the formal standard that defines what JavaScript is. The project tracks its own conformance results publicly via the ECMAScript Test262 test suite, a standard set of tests used across all JavaScript engines to measure spec compliance. You can view the exact conformance scores on the Boa website. There is also an online playground where you can try the engine directly in your browser via WebAssembly.
Boa is organized as a collection of smaller Rust crates (packages), each handling a specific piece of the JavaScript pipeline: one for lexing and parsing source code, one for the abstract syntax tree, one for the execution engine and built-in objects, one for garbage collection, and one for runtime web APIs. A command-line tool called boa_cli lets you run JavaScript files directly from your terminal, inspect the abstract syntax tree, and generate flow graphs of the compiled instructions.
The project is experimental, meaning it is functional but not production-hardened for all use cases. If JavaScript code fails to run correctly in Boa, the team treats that as a bug. Contributions are welcomed, and there are community channels on both Discord and Matrix for questions. The license is MIT or the Unlicense, your choice.
Where it fits
- Embed a JavaScript scripting engine into a Rust desktop application so users can write custom scripts.
- Evaluate user-provided JavaScript expressions at runtime inside a Rust CLI tool.
- Build a plugin system for a Rust application where plugins are written in JavaScript.
- Test JavaScript spec compliance using the command-line tool against local JS files.