Skip to content

Repository files navigation

Tableverse Kit

Open-source TypeScript toolkit for authoring digital tabletop and board-game implementations that run on Tableverse.

Tableverse Kit helps you model game state, validate and execute player commands, project hidden information per viewer, and generate local TypeScript and schema artifacts from your game definition.

You author your rules and hand Tableverse a single GameExecutor — that is the whole entrypoint to your game's backend. Tableverse hosts the game and runs the servers, transport, rooms, and persistence for you, so you never wire up an HTTP or WebSocket server yourself. (The engine stays plain enough that you can drive a GameExecutor from your own transport, but that is no longer a supported, first-class path.)

Packages

  • @tableverse-kit/engine rules/runtime engine that compiles your game into a GameExecutor for Tableverse
  • @tableverse-kit/cli local tooling package that installs the tvk command
  • @tableverse-kit/client frontend client — renderer-agnostic TableverseClient at the root, optional React hooks at @tableverse-kit/client/react

Install

bun add @tableverse-kit/engine
bun add -d @tableverse-kit/cli

or:

npm install @tableverse-kit/engine
npm install --save-dev @tableverse-kit/cli

Engine

@tableverse-kit/engine provides the runtime building blocks for a board-game rules package:

  • GameDefinitionBuilder
  • createGameExecutor(...)
  • command validation, execution, availability, and discovery
  • stage/progression lifecycle orchestration
  • deterministic RNG
  • explicit state definitions with defineGameState(...), plain state classes, and t
  • hidden-information projection with getView(...)
  • visibility configuration through the state builder
  • snapshots, replay helpers, and scenario testing

Example state definition:

import { defineGameState, t } from "@tableverse-kit/engine";

class CounterState {
  value = 0;

  increment() {
    this.value += 1;
  }
}

const Counter = defineGameState()
  .model({
    value: t.number(),
  })
  .stateClass(CounterState)
  .build();

CLI

@tableverse-kit/cli installs the tvk command.

tvk generate client-sdk
tvk validate

The CLI reads tableverse.config.ts from your project:

import { defineConfig } from "@tableverse-kit/engine/config";
import { createGame } from "./src/game";

export default defineConfig({
  game: createGame(),
  outDir: "./generated",
});

Examples

Local Development

bun install
bun run lint
bunx tsc -b
bun test --cwd packages/engine
bun test --cwd packages/cli

Additional useful checks:

bun test --cwd examples/splendor/engine
bun test --cwd examples/splendor/terminal

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages