Server-driven interactive websites using the ELM architecture.
Find a file
2026-03-29 20:59:38 +02:00
js reimplementation 2026-03-29 20:59:38 +02:00
src reimplementation 2026-03-29 20:59:38 +02:00
.gitignore Add README.md and LICENSE.txt 2026-03-09 21:31:28 +01:00
Cargo.lock reimplementation 2026-03-29 20:59:38 +02:00
Cargo.toml reimplementation 2026-03-29 20:59:38 +02:00
LICENSE.txt Add README.md and LICENSE.txt 2026-03-09 21:31:28 +01:00
README.md Add README.md and LICENSE.txt 2026-03-09 21:31:28 +01:00

Overview

LiveView is the term used by Elixir's Phoenix Framework to describe their approach to server-side rendering. This library implements LiveView using a ELM-like architecture. While the ELM-architecture is typically implemented entirely on the client, LiveView moves the client-server boundary between the browser and the state.

  • After the initial page load, the client and server keep communicating using a WebSocket connection.
  • The client sends events (e.g. button clicks) to the server.
  • The state is mutated using the Component::update function.
  • The state is rendered to a DOM using the Component::view function.
  • The previous DOM and the new DOM are compared and an incremental update is generated.
  • The incremental update is transmitted to the client and applied to the real DOM.

Benefits

  • no state duplication between client and server
  • effortless synchronisation between multiple clients
  • effortless session resumption
  • low bandwidth incremental updates
  • no need for separate client application
  • no need for api endpoints on the server

Drawbacks

  • the website can only be used if the WebSocket is connected
  • round trip latency for every interaction

Usage

Please take a look at the documentation and the examples. Until the public API has settled, the README would probably always be outdated.

Examples

  • counter - a simple counter
  • streaming - a generator pushes a new element to a list every 10ms.

Meta

Contributing

Contributions of any kind are always welcome. You can use the modern Issue / PR workflow or the traditional E-Mail based Git workflow.

Contact

You can contact me (the author) using issues or per E-Mail at liveview-rs@pfzetto.de.

License

This project is licensed under MPLv2.