watershed Collaborative data structures for Gleam

← watershed / Examples

Run the examples.

Fourteen complete Lustre applications, all compiled from Gleam. Start with a small lifecycle trace, compare conflict rules under the same action, or open the apps that push composition and browser interaction hardest.

Foundation and lifecycle

Small applications that make connection, bootstrap, subscription, and one shared structure easy to trace.

  1. Retro board (tutorial)

    The board the build guide assembles: notes in a register OR-map, votes in a tally OR-map, and presence on the focused note.

    Source and run guide ↗
    Structures
    OrMap Presence
    Payoff race
    Two people adding notes at once both keep theirs, and two votes on one note add up instead of overwriting.

Conflict semantics

The same-looking interaction under different merge and arbitration rules.

  1. Release checklist

    A go/no-go room pairing an uncoordinated OR-set checklist with a first-writer-wins captain seat and a quorum-gated release target.

    Source and run guide ↗
    Payoff race
    Checks converge immediately, exactly one captain seat survives concurrent claims, and only the captain can publish once every gate signs off.

Composition and presence

Documents with several channels, nested applications, or a transient collaboration tier.

Specialized interaction

Editors and visual surfaces where the browser boundary is part of the engineering claim.

  1. Shared text editor

    A grapheme-aware textarea bridge with anchors, IME handling, shared cursors, and a composable MVU component.

    Source and run guide ↗
    Structures
    SharedText Presence
    Payoff race
    Minimal text operations converge without replacing the whole document or losing the local caret.