A Python 3 interpreter written in Rust, able to run Python code without CPython bindings, with WebAssembly and embedding support.
dop251/goja
An ECMAScript 5.1 JavaScript engine written in pure Go, for embedding JS execution in Go applications.
- Stars
- 7,155
- Forks
- 497
- Open issues
- 33
- Last commit
- 16 hours ago
What is it?
Goja is a JavaScript engine implemented entirely in Go, targeting ECMAScript 5.1 with most ES6 features still in progress. It lets a Go program load and run JavaScript code, pass Go values into scripts, and read results back out, without relying on cgo or a V8 wrapper.
The engine is aimed at scenarios where scripts drive logic inside a Go application, such as configuration, rules or plugin code. Because it is pure Go, it builds easily and runs on any platform Go supports. It also gives the host fine-grained control over the execution environment, including interrupting long-running scripts and mapping Go struct field names to JavaScript naming conventions.
Goja does not provide setTimeout, setInterval or Node.js APIs; those are supplied by the separate goja_nodejs project. Each Runtime instance is single-goroutine only, and performance is well below V8 for compute-heavy JavaScript.
Key features
- 01Implements ECMAScript 5.1 with regex and strict mode support.
- 02Converts Go values to JavaScript and exports JavaScript values back to Go.
- 03Calls JavaScript functions from Go, with or without a specified this value.
- 04Maps Go struct fields and methods to JavaScript names via a custom name mapper.
- 05Interrupts running scripts from another goroutine.
- 06Supports sourcemaps and can run Babel and the TypeScript compiler.
Use cases
- Embedding user-defined scripts or rules in a Go service.
- Running ES5 libraries or build tools inside a Go program without cgo.
- Building a plugin or configuration system driven by JavaScript in Go.
- Researching or controlling a JavaScript execution environment from Go.
Topics
FAQ
- What is goja?
- An ECMAScript 5.1 JavaScript engine written in pure Go, for embedding JS execution in Go applications. Goja is a JavaScript engine implemented entirely in Go, targeting ECMAScript 5.1 with most ES6 features still in progress. It lets a Go program load and run JavaScript code, pass Go values into scripts, and read results back out, without relying on cgo or a V8 wrapper.
- Is goja free to use? What license does it have?
- goja is open source under the MIT license. Check the license terms before using it in commercial products.
- Is goja still maintained?
- Actively maintained. The last commit to goja was on Oct 21, 2026.
- What can I use goja for?
- Embedding user-defined scripts or rules in a Go service. Running ES5 libraries or build tools inside a Go program without cgo. Building a plugin or configuration system driven by JavaScript in Go. Researching or controlling a JavaScript execution environment from Go.
- Where can I get goja?
- The source code and installation instructions are on GitHub: https://github.com/dop251/goja
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A super-fast TypeScript/JavaScript compiler and parser written in Rust, usable from Rust and from JavaScript.
A JavaScript-based tool for writing shell-style scripts, wrapping child_process with safe argument escaping and cross-platform helpers.
A scripting solution that lets Unity and Unreal Engine games be written in TypeScript/JavaScript, with Lua and Python backends for Unity.
Cross-platform shell, scripting language and automation framework for Windows, Linux and macOS, built for structured data and objects.
An interactive C++ interpreter built on Clang and LLVM, providing a REPL for running C++ code line by line.