Authoring
Hosting and transport
UI and tooling
Plugins
Quick recipes
“I want to author a game.” — Start with@openturn/gamekit. Drop to @openturn/core if gamekit doesn’t fit.
“I want to run a game in my React app.” — @openturn/react’s createOpenturnBindings(game, { runtime, match? }) returns a zero-prop <OpenturnProvider> that auto-resolves transport (in-process for local, bridge fragment for multiplayer — same provider in dev and prod). Read state with useMatch (just the game) or useRoom (full room with lobby, bridge, invite URL).
“I want multiplayer.” — @openturn/server on the server, @openturn/client (via React) on the client, @openturn/protocol as the wire format, @openturn/bridge to connect an embedded iframe to its hosting shell.
“I want replays.” — @openturn/replay for capture and load, @openturn/inspector-ui for the inspector UI.
“I want to deploy.” — openturn build and openturn deploy from @openturn/cli; the build pipeline is @openturn/deploy.
“I want a player to play vs the computer.” — @openturn/bot. defineBot({ decide }) writes the bot, attachLocalBot / attachLocalBots binds it to a seat, the runner dispatches autonomously. Same bot works in CLI and over WebSocket via attachHostedBot.
Dependency layering
Packages fan out from@openturn/core. A short dependency map (arrows point “depends on”):
GameSnapshot and GameDefinition as the canonical interface. You can drop any downstream package from your app and still have a working authored game.
When to reach for the uncommon packages
I need a custom transport (not WebSocket). ImplementHostedTransport in @openturn/client — pass it as transport to createHostedClient. The @openturn/protocol message types let you serialize over any duplex channel (BroadcastChannel, Web Transport, an RPC bus for tests).
I’m building my own inspector UI (not React).
Use @openturn/inspector directly — buildInspectorTimelineFromSource produces a replay-safe timeline of steps from snapshots, batches, and (optionally) a compiled graph. It returns plain data you can render with any UI framework.
I’m writing a CLI tool that runs games outside openturn-cloud.
Bun-only tools can depend on @openturn/deploy (build pipeline) and @openturn/server (local room runtime) together. See scripts/ for examples.
I want to render a saved replay without connecting to any live match.
Import @openturn/replay for the envelope schema and @openturn/inspector-ui’s createInspector(bindings).ReplayInspector. No server, no client, no bridge.
I’m embedding a game iframe into a non-openturn host.
@openturn/bridge is the whole wire. createGameBridge inside the iframe, createBridgeHost on your shell — no dependency on openturn-cloud itself.