Skip to content

Project Scenarios

This section describes five example projects, each built on a different part of the Starfish API. The goal is to show which primitive fits which problem. The projects are illustrative but the code is valid against the TypeScript SDK.

ProjectDescriptionStarfish features
ConstellationPublic installation where each phone is a point of lightPresence, clock sync, broadcast
DuetPairs two anonymous users for low-latency interactionPools, WebRTC, unreliable delivery
The Long MuralPersistent shared drawing canvasShared state ops, scopes, optimistic concurrency
ChorusAudience phones triggered as a synchronized sound systemClock-scheduled events, broadcast, latest delivery
WanderOne-to-one message exchange between anonymous usersDirect messaging, request/reply

Each example assumes a connected client, created and connected like this:

ts
import { StarfishClient } from "@starfish/client";

const client = new StarfishClient({ server: "wss://stars.example.com" });
await client.connect();

The per-project pages pick up from there with the session join and the feature code.

Choosing a primitive

  • Presence — current per-client state (position, status, assignment). Replaces on each update.
  • Topics — many-to-many pub/sub within a named channel.
  • Broadcast and the clock — coordinate an action across many clients at a shared server time.
  • Shared state — persistent state with structured operations (list.add, counter.add, merge, replace) and optional version checks.
  • Pools — server-side matchmaking without a shared room name.
  • WebRTC — low-latency peer-to-peer data path that bypasses the server.
  • Direct messaging — messages addressed to specific clients.

See the Quick Start to get running, and the Cookbook for the individual patterns used across these scenarios.