open-rgs
A small, MIT-licensed Remote Game Server. One Bun file boots a WebSocket, a TypeScript math module, and a wallet adapter.
bun add @open-rgs/core @open-rgs/contract @open-rgs/platform-mock import { createServer, binaryTransport, loadTsMath } from "@open-rgs/core";
import { defineGame } from "@open-rgs/contract";
import { MockPlatform } from "@open-rgs/platform-mock";
await createServer({
manifest: defineGame({
id: "hello", declaredRtp: 0.95, defaultMode: "default",
modes: { default: { math: await loadTsMath("./maths/spin.ts"), stakeMultiplier: 1 } },
}),
platform: new MockPlatform({ startingBalance: 100_000 }),
transport: binaryTransport({ port: 8080 }),
}); Start here
- How it works: mile-high: the four parts and how a round flows through them
- You can build...: slot, Mines, Chicken-Road, crash, gamble, feature buys. The math file changes, everything else stays
- You can extend...: plug your own wallet, transport, math loader helpers, metrics, log formatter
Reference
- Boot: createServer config, manifest, ports, shutdown
- REST & deferred close: plain HTTP and JSON, and letting the client end a round explicitly
- Retries & ops: idempotent resends, the canonical op vocabulary, and a client that plays any game
- Wire: binary-msgpack frames and payload shapes
- Extensions: grid, reels, pays, cascade, hold & win. One small package per concern
- Math . simple: single-call rounds: slots, instant-win, dice, plinko
- Math . complex: open / step / close: Mines, Chicken-Road, gamble, crash
- Carry: state that outlives a round: who stores it, and when it is discarded
- Platform adapter: wallet, sessions, money flow
- Admin & probes: /livez, /readyz, /healthz, /admin/*, metrics
- Errors: canonical error vocabulary
Source
- GitHub: code, issues, releases
- Spec corpus: design corpus and ADRs
- MIT License