# openturn ## Docs - [Authoring with AI agents](https://openturn.io/docs/agent-skills.md): Install the Openturn skill so Claude Code, Codex, Cursor, and other agents are calibrated on Openturn's APIs and conventions when building games for you. - [Authoritative state and snapshots](https://openturn.io/docs/concepts/authoritative-state.md): What lives in G, what lives in the snapshot around it, and the rules for deciding where something belongs. - [AI bots](https://openturn.io/docs/concepts/bots.md): How `@openturn/bot` plugs computer-controlled players into a game without coupling to engine internals — author a `decide` function, attach to a seat, the runner handles the rest. - [Events, states, and transitions](https://openturn.io/docs/concepts/events-states-transitions.md): The three primitives that make up a core game definition. - [Gamekit: the move-first layer](https://openturn.io/docs/concepts/gamekit.md): How `@openturn/gamekit` turns phase + move + outcome authoring into a pure core game definition. - [Gamekit moves and outcomes](https://openturn.io/docs/concepts/gamekit-moves-and-outcomes.md): The full set of move outcomes, what each compiles to, and when to reach for each one. - [Gamekit turn gating](https://openturn.io/docs/concepts/gamekit-permissions-and-turns.md): How gamekit decides which seat may dispatch a move. - [Gamekit views and computed](https://openturn.io/docs/concepts/gamekit-views-and-computed.md): Computed values, public views, player views, and the view helpers gamekit ships. - [Local vs hosted architecture](https://openturn.io/docs/concepts/local-vs-hosted.md): How the same game definition drives a single-process session and a Durable Object-backed multiplayer room. - [Mental model](https://openturn.io/docs/concepts/mental-model.md): The four ideas the engine relies on, and why authored games are pure values. - [Persistent profiles](https://openturn.io/docs/concepts/persistent-profiles.md): Per-player state that survives across matches — card collections, unlocks, currency — and how it flows in and out of the engine. - [Reducers and queued events](https://openturn.io/docs/concepts/reducers-and-queued-events.md): Labelled resolvers, deterministic internal events, and how to keep complex flows debuggable. - [Runtime boundaries](https://openturn.io/docs/concepts/runtime-boundaries.md): Openturn packages are classified by what they execute, not where they are developed. This page maps the lines. - [Selectors and player views](https://openturn.io/docs/concepts/selectors-and-player-views.md): Derive data from G, and project it into the shape each audience should see. - [Turns, phases, and control](https://openturn.io/docs/concepts/turns-phases-control.md): How the engine tracks whose turn it is and which seats are allowed to act. - [Development notes](https://openturn.io/docs/development.md): Working on the openturn monorepo. Runtime boundaries, docs updates, and the rules the repo enforces. - [Examples](https://openturn.io/docs/examples.md): The openturn repo ships several runnable games. This is the cross-reference. - [Install and run](https://openturn.io/docs/get-started/install-and-run.md): Clone the openturn repo, install dependencies, and run the example apps end to end. - [Your first game](https://openturn.io/docs/get-started/your-first-game.md): Scaffold a new openturn project, edit the authored game, and run it locally in ten minutes. - [Add an AI bot to a game](https://openturn.io/docs/how-to/add-a-bot.md): Drop a computer opponent into any seat — random, heuristic, or search-based — without changing the engine or the game logic. - [Add a CLI front-end](https://openturn.io/docs/how-to/add-a-cli.md): Drive a local session from a Bun script to get a terminal UI with no browser involved. - [Author a game with core directly](https://openturn.io/docs/how-to/author-with-core.md): The primitive authoring recipe. Events, states, transitions, selectors, views. - [Author a game with gamekit](https://openturn.io/docs/how-to/author-with-gamekit.md): The move-first authoring recipe. Setup, phases, moves, permissions, views. - [Bind a game to React](https://openturn.io/docs/how-to/bind-to-react.md): Use `@openturn/react` to turn an authored game into a typed React context with hooks. - [Build a lobby](https://openturn.io/docs/how-to/build-a-lobby.md): Use `LobbyRuntime` on the server and `` (or `` + `useRoom`) on the client to run a pre-game lobby with seat assignment and optional bot dropdowns. - [Capture and replay matches](https://openturn.io/docs/how-to/capture-replays.md): Serialize a match to JSON with `@openturn/replay`, load it later, and materialize it into an inspectable timeline. - [Configure match settings in the lobby](https://openturn.io/docs/how-to/configure-match-settings.md): Declare a typed config schema on your game so the host can pick settings (turn timer, score target, variant, etc.) in the lobby before the match starts. Values are agreed by all viewers and locked into `match.config` at game-start. - [Debug with inspector](https://openturn.io/docs/how-to/debug-with-inspector.md): Use `@openturn/inspector-ui` to inspect matches, scrub replays, and see every resolver branch fire. - [Deploy to openturn cloud](https://openturn.io/docs/how-to/deploy-to-openturn-cloud.md): Build your openturn project and ship it to openturn.io with `openturn deploy`. - [Enforce turn timeouts](https://openturn.io/docs/how-to/enforce-turn-timeouts.md): Declare a per-state deadline and have the server fire a trigger when wall-clock elapses. The game decides the response — auto-pass, random move, forfeit, anything you want — through a typed transition handler. - [Handle randomness deterministically](https://openturn.io/docs/how-to/handle-randomness.md): Use the deterministic RNG from `@openturn/core` for every random decision. Never reach for `Math.random`. - [Handle simultaneous moves](https://openturn.io/docs/how-to/handle-simultaneous-moves.md): Use phase-level `activePlayers` and `move.stay` to let players act in parallel. A pattern from paper-scissors-rock. - [Model hidden information with player views](https://openturn.io/docs/how-to/model-hidden-info.md): Keep secrets in `G` and filter them at the view layer. A worked pattern from battleship. - [Persist player state across matches](https://openturn.io/docs/how-to/persist-player-state.md): Add a profile to your game, test it locally, and deploy it — including what openturn-cloud handles for you and where to plug in a local store. - [Play against bots in the lobby](https://openturn.io/docs/how-to/play-against-bots.md): Wire a typed `BotRegistry` into a game, render `` with per-seat dropdowns, and let humans pick their computer opponent before the match starts. Works for local single-device, OSS hosted dev, and openturn-cloud. - [Run a local session](https://openturn.io/docs/how-to/run-a-local-session.md): Use `createLocalSession` to run a game in-process — in tests, CLIs, or anywhere React is overkill. - [Run a local hosted stack](https://openturn.io/docs/how-to/run-local-hosted.md): Use `openturn dev` to run your game with an authoritative Bun server, SQLite persistence, and anonymous auth. - [Introduction](https://openturn.io/docs/index.md): Openturn is a TypeScript framework for turn-based games — local prototypes, replays, and cloud-hosted multiplayer all from one authored game definition. - [Publish packages](https://openturn.io/docs/publishing.md): How maintainers publish @openturn packages to npm with Changesets and the release workflow. - [@openturn/bot](https://openturn.io/docs/reference/bot.md): Plug-and-play AI bots over `@openturn/core`. Author with `defineBot`, attach with `attachLocalBot` or `attachHostedBot`, and the bot drives a seat just like a human player would. - [@openturn/bridge](https://openturn.io/docs/reference/bridge.md): The wire between a game iframe and its hosting shell — fragment protocol, postMessage schema, and shell-controls registry. - [@openturn/cli](https://openturn.io/docs/reference/cli.md): The `openturn` binary. `create`, `dev`, `build`, `deploy`, `login`. - [@openturn/client](https://openturn.io/docs/reference/client.md): WebSocket client for a hosted openturn match. Connect, dispatch, sync, resync. - [@openturn/core](https://openturn.io/docs/reference/core.md): The canonical authoring surface and runtime. `defineGame`, events, states, transitions, `createLocalSession`. - [@openturn/deploy](https://openturn.io/docs/reference/deploy.md): Build pipeline for openturn projects. Discover `app/` files, emit a client bundle and a Cloudflare Worker script. - [Examples index](https://openturn.io/docs/reference/examples.md): Every example package with its path and the bun --filter command to run it. - [@openturn/gamekit](https://openturn.io/docs/reference/gamekit.md): Move-first authoring on top of `@openturn/core`. Moves, phases, outcomes, permissions, turns, views. - [@openturn/inspector](https://openturn.io/docs/reference/inspector.md): Non-UI inspector logic: build an inspectable timeline from a replay or hosted batch stream. - [@openturn/inspector-ui](https://openturn.io/docs/reference/inspector-ui.md): React components for inspecting local sessions, replays, and hosted matches. - [@openturn/json](https://openturn.io/docs/reference/json.md): JSON types, Zod schema, and validators that every runtime surface uses. - [@openturn/lobby](https://openturn.io/docs/reference/lobby.md): Unified lobby surface — protocol extensions, runtime helpers, React UI, bot registry, and bot supervisors. One package, five subpath exports, both local single-device and hosted multiplayer. - [@openturn/manifest](https://openturn.io/docs/reference/manifest.md): Deployment manifest schema and HTML generator, shared by the build tool and the cloud shell. - [Packages overview](https://openturn.io/docs/reference/packages.md): Every openturn package, its runtime, and when to reach for it. - [@openturn/plugin-chat](https://openturn.io/docs/reference/plugin-chat.md): First-party in-room chat plugin — server-authoritative chat slice plus a drop-in React widget. - [@openturn/plugins](https://openturn.io/docs/reference/plugins.md): Compose cross-cutting features (chat, votes, emotes) into a gamekit game without forking the host. - [@openturn/protocol](https://openturn.io/docs/reference/protocol.md): The wire protocol between hosted clients and the authoritative runtime. Zod-validated, JSON-only. - [@openturn/react](https://openturn.io/docs/reference/react.md): React hooks and components for local matches, hosted matches, and lobbies. - [@openturn/replay](https://openturn.io/docs/reference/replay.md): Saved replay envelopes, timeline materialization, cursor-based playback, branching. - [@openturn/server](https://openturn.io/docs/reference/server.md): Authoritative room runtime, lobby, Cloudflare Worker factory, room tokens, and persistence. - [Tic-tac-toe with bots](https://openturn.io/docs/tutorials/tic-tac-toe-bot.md): Add an AI opponent to the tic-tac-toe CLI — a five-line random bot, then an alpha-beta minimax bot — without changing the game definition's logic. - [Tic-tac-toe with core directly](https://openturn.io/docs/tutorials/tic-tac-toe-core.md): Author the same tic-tac-toe game using `@openturn/core` alone, with no gamekit sugar, for when the state graph is the interesting part. - [Tic-tac-toe with gamekit](https://openturn.io/docs/tutorials/tic-tac-toe-gamekit.md): Build the full tic-tac-toe example from scratch — worker game package, React app, and optional CLI — using `@openturn/gamekit`. - [Tic-tac-toe as hosted multiplayer](https://openturn.io/docs/tutorials/tic-tac-toe-multiplayer.md): Reuse the tic-tac-toe game package from tutorial 1, host it on a local dev server, then deploy to openturn cloud. - [Tic-tac-toe replay viewer](https://openturn.io/docs/tutorials/tic-tac-toe-replay.md): Capture a tic-tac-toe match to JSON with `@openturn/replay`, load it in a viewer app, and inspect every frame with the inspector. - [Type system layers](https://openturn.io/docs/type-layers.md): How a game's static type flows from author input through gamekit, defineGame, and the hosted match state. Maintainer-focused. ## OpenAPI Specs - [openapi](https://openturn.io/docs/api-reference/openapi.json)