No description
  • Scala 98.9%
  • JavaScript 0.7%
  • Shell 0.3%
  • Nix 0.1%
Find a file
2026-08-06 00:35:13 +02:00
docs feat(docs): add runtime x-ray inspector 2026-08-06 00:35:13 +02:00
documentation feat(docs): add runtime x-ray inspector 2026-08-06 00:35:13 +02:00
e2eApp feat(html): redesign live binding API 2026-08-04 03:15:28 +02:00
examples feat(html): redesign live binding API 2026-08-04 03:15:28 +02:00
scalive feat(docs): add runtime x-ray inspector 2026-08-06 00:35:13 +02:00
scaliveTesting feat(html): redesign live binding API 2026-08-04 03:15:28 +02:00
scripts chore(e2e): run full upstream suite by default 2026-04-25 23:19:57 +02:00
test feat(streams): improve stream API ergonomics 2026-08-03 04:27:11 +02:00
.envrc Initial commit 2025-08-03 19:51:02 +02:00
.gitignore feat(docs): add runtime x-ray inspector 2026-08-06 00:35:13 +02:00
.scalafix.conf Configure scalafix 2025-11-07 05:10:10 +01:00
.scalafmt.conf Configure scalafix 2025-11-07 05:10:10 +01:00
AGENTS.md docs: update agent instructions 2026-05-04 05:10:40 +02:00
build.mill feat(docs): establish documentation build graph 2026-08-04 09:52:30 +02:00
DomDefsGenerator.mill feat(core): add generated namespaced composite keys 2026-04-16 22:45:03 +02:00
flake.lock build(deps): update Phoenix LiveView to 1.1.28 2026-05-04 06:17:49 +02:00
flake.nix feat(docs): add runtime x-ray inspector 2026-08-06 00:35:13 +02:00
NpmAssets.mill build(assets): use npm asset pipeline 2026-05-04 03:58:51 +02:00
README.md feat(html): redesign live binding API 2026-08-04 03:15:28 +02:00
UPSTREAM_COMPATIBILITY.md feat(lifecycle): improve lifecycle API ergonomics 2026-08-03 22:29:43 +02:00

Scalive

Scalive is a Scala 3 implementation of the Phoenix LiveView programming model. It keeps the LiveView mental model while using Scala features for typed messages, typed models, typed route params, ZIO effects, and a Scala HTML DSL.

Scalive is currently alpha software. APIs may change while the project optimizes for the best user-facing Scala API.

What A LiveView Looks Like

import scalive.*
import scalive.LiveIO.given

import zio.*

object CounterLiveView extends LiveView[CounterLiveView.Msg, Int]:
  enum Msg:
    case Increment
    case Decrement

  def mount(ctx: MountContext): LiveIO[Int] =
    ZIO.succeed(0)

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

  def render(model: Int): HtmlElement[Msg] =
    div(
      button(on.click(Msg.Decrement), "-"),
      span(s"Count: $model"),
      button(on.click(Msg.Increment), "+")
    )

Routing And Server Setup

Routes start from scalive.live and are assembled with Live.router. See examples/src/scalive/examples/ExamplesApp.scala for a complete runnable setup including static assets, routes, socket configuration, and root layout wiring.

Client Setup

Scalive uses a LiveView-compatible JavaScript client connection. The examples app shows the expected socket path and static asset setup. Start with examples/src/scalive/examples/ExamplesRootLayout.scala and examples/src/scalive/examples/ExamplesApp.scala when wiring a new application.

Running The Project

mill examples.run
mill --ticker false scalive.test
mill --ticker false __.test

The project runs inside nix develop; mill is available there.

Documentation

  • Public API reference: docs/public-api-reference.md
  • API improvement backlog: docs/api-improvement-ideas.md
  • Phoenix LiveView compatibility notes: UPSTREAM_COMPATIBILITY.md
  • Human-oriented examples: examples/README.md and examples/src
  • Upstream parity fixtures: e2eApp/src

The parity fixtures are useful compatibility evidence, but they are not always recommended application style. Prefer examples and the public API reference for learning the normal Scalive API.

Compatibility

Scalive aims to match Phoenix LiveView behavior and feature set where that makes sense for Scala. It intentionally diverges when Scala-first APIs improve type safety, robustness, or ergonomics.

Do not assume complete Phoenix LiveView parity without checking UPSTREAM_COMPATIBILITY.md and the upstream parity fixtures in e2eApp/src.