Skip to main content
tabletop-engine

The runtime for
board game rules engines.

Express your game’s state, commands, and turn flow as plain TypeScript. tabletop-engine handles validation, execution, hidden information, and deterministic replay — so you can ship the rules with confidence.

Model state with decorators.

Describe your game’s data model with @State() and @field(). The engine compiles a type-safe canonical schema, hydrates a working facade for execution, and projects per-player views for hidden information — all from one declaration.

Learn about state →

Author commands with validate and execute.

Every player action is a command with a validate step and an execute step. The engine runs them transactionally, surfaces structured errors, and emits semantic events you can stream to clients.

Learn about commands →

One executor for your rules.

createGameExecutor gives you a single runtime that handles command dispatch, stage progression, deterministic RNG, snapshots, and replay. Use it to drive local tests, simulations, and game sessions from the same rule definitions.

Executor reference →

Generate schemas and types from your rules.

Use the CLI to derive JSON schemas and TypeScript declarations from your game definition. Keep runtime validation, generated types, and tests aligned with the rules your engine actually runs.

CLI reference →

Built for real games.

Everything you need to model rules end-to-end — from the first turn to a reproducible runtime.

Hidden information

Project a different view of state to each player. The engine sanitizes canonical state into per-seat views automatically.

Stage progression

Model setup, draft, action, and scoring phases as a progression graph. The engine handles transitions and lifecycle resolution.

Deterministic RNG

Seeded, replayable randomness baked into the runtime — shuffle decks and roll dice without breaking determinism.

Snapshots & replay

Capture any state, replay any sequence of commands. Reproduce bugs from production logs in a single line.

Scenario testing

A test harness designed for game logic. Drive games through full flows with concise, declarative scenarios.

Rules-first runtime

Run setup, commands, stages, visibility, snapshots, and replay through one engine-owned execution path.

Build your next game.

Install the package, define a state, write a command, and run it. The first end-to-end game takes about ten minutes.