Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Quickstart

Liminal is a typed actor framework built on Effect. A minimal app has five pieces:

  1. a Client protocol shared by browser and server
  2. an Actor that implements that protocol
  3. hydration logic for newly connected sockets
  4. method handlers that run inside actor context
  5. a runtime host, such as Cloudflare Workers and Durable Objects

This quickstart uses tic-tac-toe as the running example. Each step links to the focused concept page with the full code.

Define the client protocol

Create a Client with state, external method schemas, and event schemas. This is the shared wire contract for browser and server.

Read: Clients, Methods, and Events.

Define the actor

Create an Actor that points at the client protocol and defines the durable actor name plus per-client attachments.

Read: Actors and Actor Context.

Add lifecycle and handlers

Use hydrate for newly upgraded sockets, especially initial state. Implement external methods with Actor.handler(...).

Read: Lifecycle, Actor Handlers, and Client Handles.

Host on Cloudflare

Cloudflare hosting defines a Durable Object namespace and a separate actor runtime, then upgrades an HTTP route into a bound actor instance.

Read: Actor Namespace, HTTP Upgrades, and Worker Entrypoint.

Connect from the browser

Provide the protocol with Client.layerSocket(...), reducers, and BrowserSocket.layerWebSocketConstructor. Once the layer is in scope, use Client.fn(...) for calls, Client.events for events, and Client.state for hydrated state.

Read: Client Layer, Client Calls, Events, and Client State.