Why This Matters
QuickBEAM introduces a JavaScript runtime integrated into the BEAM ecosystem, enabling developers to run JavaScript as supervised OTP processes with seamless interaction between JS and Elixir/Erlang. This innovation enhances the flexibility and interoperability of the BEAM platform, allowing for more versatile application development and improved performance. It signifies a step forward in unifying different programming environments within the Erlang ecosystem, benefiting both developers and end-users by enabling more dynamic and scalable applications.
Key Takeaways
- JavaScript runs as supervised GenServers within the BEAM, facilitating better process management.
- QuickBEAM enables direct calling of Elixir functions and OTP libraries from JavaScript.
- Supports messaging between JS processes and BEAM processes, enhancing inter-language communication.
QuickBEAM
JavaScript runtime for the BEAM — Web APIs backed by OTP, native DOM, and a built-in TypeScript toolchain.
JS runtimes are GenServers. They live in supervision trees, send and receive messages, and call into Erlang/OTP libraries — all without leaving the BEAM.
Installation
def deps do [ { :quickbeam , "~> 0.7.1" } ] end
Requires Zig 0.15+ (installed automatically by Zigler, or use system Zig).
Quick start
{ :ok , rt } = QuickBEAM . start ( ) { :ok , 3 } = QuickBEAM . eval ( rt , "1 + 2" ) { :ok , "HELLO" } = QuickBEAM . eval ( rt , "'hello'.toUpperCase()" ) # State persists across calls QuickBEAM . eval ( rt , "function greet(name) { return 'hi ' + name }" ) { :ok , "hi world" } = QuickBEAM . call ( rt , "greet" , [ "world" ] ) QuickBEAM . stop ( rt )
BEAM integration
JS can call Elixir functions and access OTP libraries:
... continue reading