Star

This is a demo of Lunatic VM which runs WebAssembly as lightweight processes similar to Erlang and Go.

Write a simple command line app and run it as a web server. Simply read HTTP requests from the standard input and write response to the standard output!

Examples

  • Upload
  • env_vars.rs
  • add_form.rs
  • fib.c
  • hello.ts
  • hello.swift
Drag and drop your .wasm file into this area

FAQ

What is Lunatic?
Lunatic is a universal runtime for fast, robust, and scalable server-side applications. It's inspired by Erlang and can be used from any language that compiles to WebAssembly.
What is Erlang?
Erlang is a programming language and platform developed by Ericsson. It's used to build massively scalable and highly available real-time systems. Almost all Internet traffic is going through routers and switches controlled by Erlang. The technology allowed WhatsApp to scale to 1B users with just a handful of engineers.
How can Lunatic help with security?

WebAssebmly was initially developed to run in the browser and provides extremely strong sandboxing on multiple levels. Lunatic's processes inherit this property.


Each process has its own stack, heap, and even syscalls. If one process fails, it will not affect the rest of the system. This allows you to create very powerful and fault-tolerant abstraction.


This is also true for some other runtimes, but Lunatic goes one step further and makes it possible to use C bindings directly in your app without any fear. If the C code contains any security vulnerabilities or crashes, those issues will only affect the process currently executing the code. The only requirement is that the C code can be compiled to WebAssembly.


It's possible to give per process fine-grained access to resources (filesystem, memory, network connections, etc.). This is enforced on the syscall level. If you are unsure about one of your dependencies' security, you can call it from a process without any permissions and completely isolate it.

Does async code benefit from Lunatic?

All code running on Lunatic is by default async. Processes are scheduled by a work-stealing executor on worker threads. If one of the processes is waiting on I/O or other events, it will be moved off the worker thread until the data is ready. You can write your code in a linear/blocking manner, but Lunatic will make sure it never blocks while waiting.


Lunatic gives you some other properties that can't be easily achieved with async code. Processes are preemptively scheduled and if one process decides to go rogue by hitting an unexpected code path, it will never permanently block the thread and the rest of the system will stay responsive.

Which programming languages are supported?
All languages that can be compiled to WebAssembly (Wasm) can be run on Lunatic.
Why is it called Lunatic?
Bernard was originally working on a programming language that compiled to Lua, so he named it Lunatic. Later he decided to write a runtime for the language and called it Lunatic VM. We ended up with an actor-based language-agnostic runtime, but the original name was kept though it does not have any connections to Lua anymore.

Community

Find us onGitHub iconDiscord iconTwitter iconor subscribe to our mailing list...