# Lunatic - An Erlang inspired runtime for all programming languages (WebAssembly)

**URL:** <https://forum.devtalk.com/t/lunatic-an-erlang-inspired-runtime-for-all-programming-languages-webassembly/7664>\
**Category:** Backend Official News\
**Tags:** lunatic, wasm\
**Created:** [7 March 2021 12:09 UTC](https://forum.devtalk.com/t/lunatic-an-erlang-inspired-runtime-for-all-programming-languages-webassembly/7664 "2021-03-07T12:09:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![bkolobara](https://forum.devtalk.com/user_avatar/forum.devtalk.com/bkolobara/32/2585_2.png) [@bkolobara](https://forum.devtalk.com/u/bkolobara)\
**Post date:** [14 March 2021 13:17 UTC](https://forum.devtalk.com/t/lunatic-an-erlang-inspired-runtime-for-all-programming-languages-webassembly/7664/6 "2021-03-14T13:17:08Z")

</div>

Hi! I’m Bernard, the creator of Lunatic.

Thanks you @AstonJ for sharing our project.

I think @mindriot pretty much nailed the core idea behind it.

> [@mindriot](#):
>
> It claims to do many of the core things like isolation, own stack/heap, inter process messaging, pre-emptive scheduling, super light processes, big concurrency… but the processes themselves execute WASM and it seems like runtime features are surfaced through libraries. I think the idea is building backends from loads of tiny WASM things that live in and talk to each other on a BEAM like runtime layer.

It doesn’t need to be just “loads of tiny WASM” things, it can only be one WASM module that spawns processes from functions defined inside it. Lunatic should be usable for small projects to really big one. I love using it myself to play around with [small side projects](https://lunatic.solutions/blog/lunatic-chat/).

Lunatic can offer a bit more powerful per process isolation than you get on the BEAM. E.g:

1. You can spawn a process that can only use a limited amount of memory or CPU.
2. You can use C bindings without fear. Once everything is compiled to WebAssembly, long running code will still be preempted and crashes don’t escape the process boundary.
3. You can limit syscalls on a per process level, e.g. spawn this process but don’t let any code running in it open a network connection.
4. Redirect syscallls, e.g. if this process writes to a log file redirect the stream over the network to an Elastic cluster.
5. You can use it from you favourite language if it compiles to WebAssembly. Currently we only provide libraries for Rust and AssemblyScript.

A long term goal of the project is to be able to take some codebase, let’s say a C project, recompile it to WebAssembly and run it on top of Lunatic. If you use threads in your project, we abstract them with much more lightweight processes that share memory. If you do a blocking network read, we just take this thread off the executor until the data arrives. We want to bring as many benefits of Erlang to other languages with the least amount of work required from the developer and stay close to the existing APIs of each language.

If anyone has some questions, I would be happy to answer them.

---

_[View the full topic](https://forum.devtalk.com/t/lunatic-an-erlang-inspired-runtime-for-all-programming-languages-webassembly/7664)._
