Arc - JavaScript on the BEAM
Arc is a highly experimental JavaScript runtime that runs on the BEAM virtual machine, combining JavaScript’s familiar syntax with Erlang’s legendary concurrency and fault-tolerance capabilities. Write JavaScript code that leverages lightweight processes, message passing, and the battle-tested OTP framework.Quickstart
Get Arc running and execute your first concurrent JavaScript program in minutes
Installation
Build Arc from source with Gleam and start experimenting
Core concepts
Understand how Arc brings JavaScript to the BEAM
API reference
Complete reference for Arc’s concurrency primitives and built-in APIs
Why Arc?
Arc bridges two worlds: JavaScript’s ubiquitous syntax and the BEAM’s proven concurrency model. Instead of callbacks, promises, or async/await, Arc uses the actor model with lightweight processes and message passing.True concurrency
Spawn thousands of lightweight processes with
Arc.spawn(). Each process has its own heap and runs independently on BEAM’s preemptive scheduler.Message passing
Communicate between processes using
Arc.send() and Arc.receive(). No shared memory, no race conditions, no locks.Process isolation
Each spawned process gets a complete copy of the VM state. Mutations in child processes never affect the parent.
Familiar syntax
Write standard JavaScript with all the language features you know: functions, closures, objects, arrays, and ES6+ syntax.
Hello, processes
Here’s a simple example showing Arc’s concurrency primitives in action:simple.js
- Spawns a new process with
Arc.spawn() - The child process blocks on
Arc.receive()waiting for a message - The main process sends a message using
Arc.send(pid, message) - Both processes log their PIDs with
Arc.self()
Key features
Actor-based concurrency
Arc implements the actor model. EveryArc.spawn() creates a lightweight process (actor) with its own mailbox. Processes communicate exclusively through asynchronous message passing:
counter_actor.js
Process isolation
Each spawned process receives a complete copy of the VM state. Modifications in one process don’t affect others:mutability.js
True parallel execution
The BEAM scheduler distributes processes across cores. Multiple processes run truly concurrently:concurrent.js
Built-in JavaScript APIs
Arc implements many standard JavaScript built-ins:- Global objects:
Object,Array,Function,String,Number,Boolean,Symbol,BigInt - Collections:
Map,Set,WeakMap,WeakSet - Errors:
Error,TypeError,ReferenceError,SyntaxError,RangeError - Utilities:
JSON,Math,RegExp,Promise - Arc extensions:
Arc.spawn(),Arc.send(),Arc.receive(),Arc.self(),Arc.sleep(),Arc.log()
Current status
Arc aims for ECMAScript specification compliance and tracks progress using the official Test262 conformance suite. Check the project repository for current test262 results and implementation status.What’s next?
Get started
Install Arc and run your first program
Learn the API
Explore Arc’s concurrency primitives