Show HN: QuickBEAM – run JavaScript as supervised Erlang/OTP processes
QuickBEAM is an innovative project that embeds a JavaScript runtime directly into the Erlang/OTP VM, allowing JS to run as supervised BEAM processes. It provides seamless integration, bypassing JSON boundaries, and offers browser-style APIs backed by native OTP primitives. This enables full-stack JavaScript development within the robust Erlang ecosystem without relying on Node.js.
The Lowdown
QuickBEAM is an innovative project that embeds a JavaScript runtime directly within the Erlang/OTP VM. It aims to bridge the gap between JavaScript and BEAM by allowing JS code to run as first-class, supervised Erlang processes, enabling full-stack development without relying on Node.js.
- Core Concept: JavaScript runtimes operate as GenServers within OTP supervision trees, allowing them to call Elixir code, send/receive messages, and participate in BEAM's fault-tolerance model.
- Seamless Integration: Eliminates the JSON boundary between JS and Erlang, enabling direct data conversion between JS values and BEAM terms, and provides a
Beamglobal object for deep interop. - Web API Backing: Offers browser-style APIs (e.g.,
fetch,WebSocket,DOM) backed by native OTP/BEAM primitives and C libraries (like Lexbor for DOM), avoiding JS polyfills. - Full-Stack Capabilities: Designed for use cases like Server-Side Rendering (SSR) with native DOM, sandboxed user code, per-connection state, and direct backend JS interaction with OTP.
- Robust Supervision & Sandboxing: JS runtimes are supervised and restartable. They can be configured with memory and reduction limits, offering strong isolation and resource control.
- TypeScript & NPM Support: Includes a built-in TypeScript toolchain via OXC Rust NIFs for direct
.tsevaluation, transformation, minification, and bundling. It also features an integrated npm client for dependency management without Node.js. - Performance & Scaling: Benchmarks show significant speed improvements over JSON-based interop. It offers different deployment strategies (individual runtimes, context pools) for various concurrency needs, emphasizing efficient resource usage for thousands of concurrent connections.
- Node.js Compatibility: Implements core Node.js APIs (e.g.,
fs,path,process,os) to ease migration and enable broader JS ecosystem compatibility.
QuickBEAM presents a compelling solution for developers looking to integrate JavaScript deeply and efficiently into the Erlang/Elixir ecosystem, offering a unique blend of fault tolerance, performance, and modern development tooling within the BEAM VM.