Why Rewi?

The trend of building apps as Single Page Applications (SPAs) has created enormous complexity in development. Traditional server rendered apps are much easier to work with, but they fail to meet user expectations about interactivity and snappiness.

A recent approach loosely referred as "HTML over the wire" is trying to change this. Popularized by Phoenix Liveview, the idea is to keep rendering on the server and diffing the contents of the page with what the server sends back. This is a wonderful approach because developers work on what is effectively a server-side app, but the UX for the end user is on par with what you would expect from a SPA. Best of both worlds.

Other frameworks that are pushing for a similar approach are Hotwire and Livewire.

All these frameworks work with dynamically typed languages (Elixir, Ruby, PHP), so why not create something similar for Typescript? That's the main idea behind this project – experiment with sending HTML over the wire while adding static typing on top, and see what kind of benefits that could bring.

Elm roots

I'm a big fan of the Elm language.

The Rewi model is heavily inspired by The Elm Architecture, with the huge difference (and potentially benefit) that everything runs server-side.

Working with Typescript can be annoying sometimes, because the typesystem has to accomodate the way Javascript works. Rewi tries to bridge the gap whenever possible, shipping with ts-pattern for exhaustive pattern-matching and zod for type-safe data validation.