open-rgs
A small, MIT-licensed Remote Game Server. One Bun file boots a WebSocket, a Lua math module, and a wallet adapter.
bun add @open-rgs/core @open-rgs/contract @open-rgs/platform-mock import { createServer, binaryTransport, loadLuaMath } 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 loadLuaMath("./maths/spin.lua"), stakeMultiplier: 1 } },
}),
platform: new MockPlatform({ startingBalance: 100_00 }),
transport: binaryTransport({ port: 80 }),
}); 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, Lua VM helpers, metrics, log formatter
Reference
- Boot — createServer config, manifest, ports, shutdown
- Wire — binary-msgpack frames and payload shapes
- Math · simple — single-call rounds: slots, instant-win, dice, plinko
- Math · complex — open / step / close: Mines, Chicken-Road, gamble, crash
- 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