Before you deploy to openturn cloud, you want to prove the multiplayer flow on your own machine.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.
openturn dev runs a production-shaped hosted stack against your project’s app/ folder. No cloud credentials, no network configuration.
Prerequisites
You need a project with the three-file layout:app/game.tsexportinggameandmatch.app/page.tsxrendering the React UI.app/openturn.tswith metadata. For hosted, setruntime: "multiplayer".
Start the server
From the project root:- Serves the bundled React app at
/play/<deploymentID>. - Hosts a WebSocket endpoint for
@openturn/clientto connect to. - Runs your authored game inside
@openturn/server’screateRoomRuntime. - Persists rooms in a SQLite database (default
.openturn/local-dev.sqlite). - Signs anonymous session tokens with
@better-authso each window gets its own user.
Play
Open the play URL in two browser windows. In the first window, create a room. Share the invite URL (the CLI also prints it on room creation) to the second window. Both windows land in the same lobby. When the lobby reaches its minimum player count,LobbyRuntime signs game tokens and the clients transition into the hosted match. Moves dispatched in either window go over WebSocket to the shared runtime and broadcast back as BatchApplied messages.
Inspect what is happening
The CLI logs every room action, token issuance, and WebSocket event. Open the SQLite database with any SQLite client to see the persisted room records:openturn_rooms— current room state (checkpoint, log, match).openturn_room_players— seat assignments.openturn_audit_events— room audit log.
Hot reload
openturn dev watches app/game.ts. Saving a change rebuilds the bundle and swaps the deployment in-process. Open rooms keep running against the previous deployment version; new rooms pick up the update.
For serious game-logic iterations, reset by deleting the SQLite file between runs or passing a fresh --db path.
Resetting a dev database
Using the runtime programmatically
If you need a custom dev shell, the CLI server is also exported:openturn dev covers the common case.
Related
- Tutorial: tic-tac-toe multiplayer walks through the full local hosted flow.
- How-to: deploy to openturn cloud for the production path.
- Reference: cli and reference: server.