Erlscripten – Transpiling Erlang to Javascript. Yes, you read it right

It is safe to say that Erlang as a language and framework is the most reliable choice out there to build highly stable applications, running the likes of Whatsapp and Discord. Now, there is a transpiler introducing concepts of Erlang to web technology, which would be near impossible to implement manually using Javascript.

Here at æternity, we’ve envisioned for a long time that running major parts of a blockchain protocol in the context of modern web frameworks would mean a huge leap for the adoption and scalability of distributed ledger technology. What if you could run an ad-hoc blockchain node in your browser, or use state channels to quickly make safe payments using your phone?

As a solid foundation had to be laid for a reliable infrastructure first, that was not conceivable as of yet. Until now.

Erlscripten is here.

Erlscripten (sic not Emscripten!) is a source-to-source transpiler capable of converting most Erlang codebases into semantically equivalent Purescript projects. Purescript is a strongly typed language heavily inspired by Haskell and which compiles down to Javascript. Taking Purescript as an intermediary step, Erlscripten allows you to take your existing Erlang application and easily ship it out to Javascript users — your Erlang code can now run safely in the browser — enabling code sharing between an Erlang backend and the frontend. It is highly interoperable with Javascript — Javascript can easily call the transpiled code and then make use of the results — you can easily map Erlang constructs and types to readily available JS constructs.

It’s zero hassle — you point Erlscripten to an existing Rebar3 Erlang project and in result get a compatible spago project ready to be used in existing Purescript/Javascript projects. While at it, we transpiled the Erlang runtime (ERTS) that allows you to run arbitrary transpiled Erlang code:


Besides bringing the components of the æternity blockchain to more platforms and web frameworks, there are two novel use cases for Erlscripten:

1 — Code reuse between Erlang backends and Javascript frontends;

2 — The creation of a new paradigm for developing frontend applications.

æternity is a blockchain platform primarily written in Erlang. In the upcoming era of Hyperchains the need for code distribution between frontend and backend applications is high. Therefore we need to move some parts of æternity infrastructure to the clients’ side in order to provide a more reliable and decentralized system. It doesn’t make sense to rewrite our code in Javascript/Rust manually as this would require a lengthy rewrite and then the need to maintain and sync 2 codebases. The high need of interoperability between Erlang and Javascript is where Erlscripten was born. We can transpile what we need and distribute it to the browser where it’s needed. One side effect of Erlscripten is that it will soon be possible to write Frontend applications directly in Erlang — Erlang’s actor based programming maps really nicely to existing reactive frameworks.

Run Erlang in the browser!

Erlang to PureScript transpiler >

Read the complete article on the æternity blog:


This is awesome. This is a disruptive product


I agree with it