Quickstart
Liminal is a typed actor framework built on Effect. A minimal app has five pieces:
- a
Clientprotocol shared by browser and server - an
Actorthat implements that protocol - hydration logic for newly connected sockets
- method handlers that run inside actor context
- 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.