mayu

The Mayu dolphin
mayu

Reactive web pages in Ruby

Mayuisaliveupdatingserver-siderenderingwebframeworkwritteninRuby

Interactive web apps without JavaScript

  • Use Haml for markup, Ruby for logic.
  • All code runs on the server.
  • All HTML is rendered on the server.
  • DOM-patches are streamed to the browser.

How does it work?

  • Mayu implements a Virtual DOM in Ruby.
  • All DOM updates are streamed to a small browser runtime that takes care of patching the DOM.
  • Event handlers run on the server.

Efficient

  • HTTP/2 Streams with compression and MessagePack.
  • Designed to be deployed on the edge.
  • Pages are interactive immediately on FCP.
  • Prometheus-endpoint for real-time metrics.

Developer friendly

  • Hot reloading updates the page as soon as you save.
  • Asynchronous code without async/await or promises.
  • Ruby and Haml are really nice languages to work with.

Live from the server

Everything on this page was rendered on the server at 21:38:24 UTC. The only JavaScript in the browser is a small runtime that patches the DOM whenever state changes on the server.

A counter

The buttons call Ruby methods.
The new count is streamed back as a DOM patch.

Counter.haml

Source is loading.View it on GitHub

7

A calculator

This calculator is implemented in Ruby.
Calculations are server-side.

Calculator.haml

Source is loading.View it on GitHub

0

A clock

This is a server-side analog clock.

Clock.haml

Source is loading.View it on GitHub

What you get

A full stack in one place: components, styling, assets, routing and a live connection to the browser.

  • 100% server side

    State, rendering and event handlers all live in Ruby.

  • 100% async

    Fibers instead of callbacks. Write straight-line code.

  • Haml components

    Markup, Ruby and CSS together in one file.

  • CSS modules

    Styles are scoped to the component that owns them.

  • Assets handled

    Import images, fonts and SVGs. Hashing and resizing are automatic.

  • Hot reloading

    Save a file and the page updates, state included.

  • File based routing

    Pages, layouts and API routes follow the directory tree.

  • Built for the edge

    HTTP/2 streams with compression and MessagePack.

Read more on GitHub