examples/<purpose>/<name> in the monorepo. Most have a game worker package (the authored game) and either an app browser package (React UI), a cli Bun package (terminal), or both.
Looking up a specific package name, path, or
bun --filter command? See the Examples index — every shipped package with its path and run command in one table.Featured: Splendor
Splendor is the flagship end-to-end example — a Splendor-faithful 2–4 player tabletop with hosted multiplayer, hidden per-player state, three difficulty-tiered AI bots, a polished React 19 + Tailwind v4 + framer-motion table, and a deploy-readyapp/ package. Use it to see what a fully realized openturn game looks like and as the canonical thing to play and stress-test against.
- Hidden information — opponents’ reserved cards stay on the worker;
views.playerprojects them down to a count. - Variable seating —
MatchInput.minPlayerslets 2, 3, or 4 players seat through<Lobby>. - End-of-round triggers — first to 15 points flips a flag; the round completes before the winner is declared.
- Bots in the lobby — per-seat dropdown picks
Random,Greedy, orStrategicfrom thebots/package. - Cloud deploy —
bun run deployfrom the app dir builds the bundle, uploads the multiplayer Worker, and prints the openturn-cloud play URL.
Get started: Tic-tac-toe
Tic-tac-toe is the smallest end-to-end gamekit example and the one every tutorial walks through. Start here when learning openturn — it’s reused across the React UI, CLI, multiplayer, replay viewer, chat-plugin, and bot examples, so the samegame/ package shows up in every recipe.
End-to-end games
Complete, runnable games underexamples/games/.
| Example | Authoring | Local UI | Hosted | Bots | Replay | Hidden info | Notes |
|---|---|---|---|---|---|---|---|
| splendor | gamekit | React | hosted | 3 (random / greedy / strategic) | — | yes | Flagship demo. 2–4 players, polished tabletop UI, deploy-ready. |
| tic-tac-toe | gamekit | React + CLI | — | 2 (random / minimax) | capture | no | Get-started example. Reused across multiplayer, replay viewer, chat plugin. |
| pig-dice | gamekit | CLI | — | — | — | no | Simple 2-player dice push-your-luck CLI. |
| battleship | gamekit | React | hosted | — | — | yes | Hidden fleets, multi-phase (planning → battle → gameOver), hosted multiplayer. |
Authoring with raw @openturn/core
Under examples/using-core/ — same games as their gamekit counterparts, written without gamekit.
| Example | Notes |
|---|---|
| tic-tac-toe-core | Tic-tac-toe authored with @openturn/core directly. |
| paper-scissors-rock-core | Simultaneous-move RPS in raw core. |
| persistent-wins-core | Profile lifecycle in raw core. |
Persistent player profiles
Underexamples/using-profiles/ — hydrate → play → commit → apply.
| Example | Notes |
|---|---|
| persistent-wins | Gamekit demo of the profile lifecycle. |
| card-discovery | Card memory game showing the host-side commit hook. |
By concept
Each example is the canonical demo for one openturn concept.| Concept | Example | Notes |
|---|---|---|
| Featured / hosted multiplayer | splendor | 2–4 player Splendor with <OpenturnProvider> + useRoom + lobby bots. The flagship end-to-end demo. |
| Simultaneous moves | paper-scissors-rock | Hidden submissions until everyone has played. 3 players. Also available in raw core. |
| Hosted multiplayer (minimal) | tic-tac-toe-multiplayer | <OpenturnProvider> + useRoom. Runs against openturn dev locally and openturn-cloud in production. |
| Replay capture & playback | tic-tac-toe-replay-viewer | Load a saved replay JSON and scrub through it. |
| Plugin integration | tic-tac-toe-with-chat | Tic-tac-toe with the chat plugin wired in. |
| AI bots | tic-tac-toe/bots and splendor/bots | Tic-tac-toe ships random + alpha-beta minimax wired into the CLI; Splendor ships random/greedy/strategic wired into the lobby. |
Run them
From the monorepo root. For the complete list of packages and commands (including library packages with nodev script), see the Examples index.
By tutorial
- Tic-tac-toe with gamekit walks the
tic-tac-toeexample end to end. Start here. - Tic-tac-toe multiplayer walks
tic-tac-toe-multiplayer. - Tic-tac-toe replay walks
tic-tac-toe-replay-viewer. - Tic-tac-toe with core walks
tic-tac-toe-core. - Tic-tac-toe with bots walks the
tic-tac-toe/botspackage and the bot-aware CLI.
By how-to
- Model hidden information uses battleship snippets.
- Handle simultaneous moves uses paper-scissors-rock.
- Handle randomness uses pig-dice.
- Add a CLI front-end covers the tic-tac-toe and pig-dice CLIs.
- Persist player state uses
persistent-wins(gamekit) andpersistent-wins-core.