Openturn lets you write a turn-based game once in TypeScript and run it anywhere turns make sense: on a single device, in a local dev stack, or as a cloud-hosted multiplayer service. You describe the game as a plain value (state, moves, who can act, what each player sees); openturn handles the rest — running the rules, validating moves, syncing players, recording replays. A 30-second taste:Documentation Index
Fetch the complete documentation index at: https://openturn.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
What you get
- A game is a plain value. You declare a state, a roster, moves, and views. The engine runs them. Nothing is hidden inside the framework — no globals, no implicit side effects.
- One definition, every surface. The same
defineGame(...)value powers a local React app, a CLI, a hosted multiplayer server, and a cloud deployment. Switching surfaces does not require touching the game. - Two authoring layers.
@openturn/gamekitis the shortcut: declare phases, moves, turn policy, and outcomes.@openturn/coreis the lower level — events, states, and transitions — for when you need full control of the state graph. - Deterministic replay and inspection. Every match produces a JSON log. Re-dispatch it and you get the exact same state, every time. The inspector lets you scrub through frames.
- First-class hidden information.
views.publicandviews.playerdecide what each audience sees, at the engine level — opponents never receive secrets they should not see. - Plug-and-play AI bots. Write a
decidefunction (random, heuristic, or MCTS) and drop it into any seat. The same bot runs locally and over the network.
When to reach for openturn
- You are building a turn-based, round-based, or phase-based game (chess, poker, deckbuilders, negotiation, tactics, party).
- You want server-authoritative rules and clients that never receive secrets.
- You want replays, undo, and a debug inspector without building them yourself.
- You prefer plain TypeScript definitions over config files or a DSL.
When something else might fit better
- Real-time action games (shooters, racers) where state ticks every frame.
- Games dominated by physics or continuous simulation rather than discrete moves.
- Non-game workflows that happen to be turn-shaped — a task queue or generic state machine library has less surface area.
Where to go from here
If you have never seen openturn before, follow these in order:- Install and run the examples — five minutes, just to see what the running games look like.
- Your first game — scaffold a project with
openturn createand edit your way to a playable React game in ten minutes. - Tic-tac-toe with gamekit — the full guided tour: a real game, a React UI, and an optional CLI. Subsequent tutorials reuse it for hosted multiplayer, replays, raw core authoring, and bots.
bun --filter @openturn/example-splendor-app dev.