Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline

Scala 3 · Server rendered · Fully typed

Live interfaces. Typed end to end.

Build real-time web applications entirely in Scala. Keep state and rendering on the server, handle browser events as typed messages, and send efficient HTML updates over the wire.

Build your first LiveView Browse examples

scala
import scalive.*
import zio.ZIO

enum Msg:
  case Increment

def handleMessage(model: Int, ctx: MessageContext) =
  case Msg.Increment => ZIO.succeed(model + 1)

Live result

Click Increase to send Msg.Increment to the server.

Live server

Current modelcount =0

Counter controls

This example is read-only while disconnected. Controls resume after reconnection.

  • One typed model. State, messages, transitions, and rendering remain explicit and compiler checked.

  • HTML from Scala. Build interfaces with a typed HTML DSL instead of maintaining a separate frontend component tree.

  • Live over the wire. Browser events reach the server as typed messages; Scalive sends efficient HTML diffs back.

How it works

One event travels through a small, observable server-owned loop.

  1. Browser event. A user interaction is sent over the live connection.

  2. Typed message. The event is decoded into a message your LiveView accepts.

  3. Server transition. Your handler updates typed state and can run ZIO effects.

  4. HTML diff. Scalive renders the next view and sends only the changes to the browser.

Why Scalive

Scalive brings the Phoenix LiveView model to Scala 3 and ZIO. A LiveView describes its initial state, transitions, effects, and rendered output without introducing a separate frontend component framework.

It is designed for Scala teams that want interactive applications while keeping domain logic, UI state, and effect handling in one typed server-side system. Read why I built Scalive for the journey that led to this design.

  • Scala 3

  • ZIO effects

  • Server-owned state

  • Typed HTML

  • Phoenix LiveView semantics

Start building

Follow the guided introduction, inspect the working examples, or use the API reference when you already know what you need.