Immutable Poker Engine
Redux-style state machine with strict validation, side pots, rake, tournaments, time banks and TDA-compliant raise rules.
Immutable engine, 17M+ hand/sec evaluator, typed SDK, scalable API and on-chain settlement โ one npm monorepo.
Everything a real-money poker platform needs, in one versioned monorepo โ from the pure game logic to the blockchain settlement layer:
| Capability | Highlights |
|---|---|
| Rules correctness | TDA-43/47 raise rules, side pots, odd-chip distribution, rake caps, tournament blind structures, time banks |
| Security | Masked public views (no hole cards or deck), SIWE auth, EIP-712 withdrawal intents, multi-RPC quorum, no-automatic-replacement signing |
| Financial integrity | Double-entry ledger, balanced settlement batches, tournament escrow, idempotent workers |
| Performance | Integer lookup-table evaluator: ~17M hands/sec, zero-allocation hot path |
| Deployment | Docker Compose, GitHub Actions, GitHub Pages docs, npm provenance publishing |
git clone https://github.com/aaurelions/pokertools.git
cd pokertools
npm install
npm run build
npm test # full monorepo suiteimport { evaluateStrings, getHandRank, HandRank } from "@pokertools/evaluator";
const board = ["Ts", "Jc", "Qd", "2h", "9s"];
const hero = ["As", "Kh"];
const rank = getHandRank(evaluateStrings([...board, ...hero]));
console.log(HandRank[rank]); // "Straight"import { PokerEngine } from "@pokertools/engine";
import { ActionType } from "@pokertools/types";
const engine = new PokerEngine({ smallBlind: 10, bigBlind: 20, maxPlayers: 3 });
[0, 1, 2].forEach((seat) => engine.sit(seat, `p${seat}`, `Player ${seat}`, 1000));
engine.deal();
engine.act({ type: ActionType.RAISE, playerId: "p0", amount: 60 });
engine.act({ type: ActionType.CALL, playerId: "p1" });
engine.act({ type: ActionType.FOLD, playerId: "p2" });
console.log(engine.state.street); // "FLOP"import { PokerClient } from "@pokertools/sdk";
const client = new PokerClient({ baseUrl: "https://api.example.com" });
const tables = await client.getTables();
console.log(tables);Full examples
Every example above is expanded with tables and API references on its package page: engine ยท evaluator ยท sdk ยท api.
| Package | Description | Published |
|---|---|---|
| @pokertools/types | Domain contracts, actions, DTOs, Zod schemas | โ npm |
| @pokertools/evaluator | 5/6/7-card evaluation โ integer scores, zero deps | โ npm |
| @pokertools/engine | Immutable Texas Hold'em state machine | โ npm |
| @pokertools/sdk | HTTP + WebSocket client and React 19 hooks | โ npm |
| @pokertools/api | Fastify REST/WS API, PostgreSQL authority, Redis coordination, BullMQ, Prisma | ๐ณ Docker |
| @pokertools/custody | Isolated withdrawal signer and reconciliation | ๐ณ Docker |
| @pokertools/bench | Evaluator/API/worker/socket benchmarks | local |
| @pokertools/e2e | Docker + Anvil end-to-end scenarios | local |
| Section | What you'll find |
|---|---|
| Getting Started | Requirements, install, scripts, first steps per package |
| Architecture | Component map, hand lifecycle, concurrency model, security |
| Testing & Coverage | Runners, coverage gates, acceptance prerequisites, CI wiring |
| Deployment | Docker production, GitHub Actions, backups, release checklist |
| Metric | Value |
|---|---|
| Workspaces | 8 npm packages |
| Evaluator throughput | ~17M hands/sec |
| Language | TypeScript 6.0, Solidity 0.8 |
| License | MIT |