Skip to content

Getting Started ​

Welcome to the PokerTools monorepo — an enterprise-grade Texas Hold'em stack split into small, independently publishable packages.

Requirements ​

ToolMinimumNotes
Node.js^24.15.0 || >=26.0.0LTS lines 24.15+ or 26+; CI runs 24.x
npm>= 12.2.0Workspaces + allowScripts enforcement (npm 12)
Redis >= 7requiredLocks, BullMQ queues, pub/sub fan-out and a rebuildable snapshot cache; never the authority (CI uses redis:8-alpine)
PostgreSQLrequiredThe only deployment database — authoritative Prisma persistence; compose pins postgres:18-alpine; migrate with npm run db:migrate
SQLite>= 3Disposable local-test adapter only; generated from the same Prisma model
Solidity toolchainoptionalFoundry (forge) for custody contracts and blockchain acceptance
Python/build toolsoptionalOnly if native modules (better-sqlite3) need compiling

Repository layout ​

PathPackageDescription
packages/types@pokertools/typesDomain state, actions, pots, configs, DTOs, Zod schemas
packages/evaluator@pokertools/evaluator5/6/7-card hand evaluation — pure integer score tables
packages/engine@pokertools/engineImmutable game state machine (reducer + rules)
packages/sdk@pokertools/sdkHTTP client, WebSocket transport, React hooks
packages/api@pokertools/apiFastify REST/WS API, PostgreSQL-authoritative state, Redis cache/queues, BullMQ workers, Prisma
packages/custody@pokertools/custodyIsolated custody signer — treasury keys never in the API process
packages/bench@pokertools/benchEvaluator + API/worker/socket benchmarks
packages/e2e@pokertools/e2eDocker/Anvil end-to-end scenarios

Install ​

bash
git clone https://github.com/aaurelions/pokertools.git
cd pokertools
npm install        # runs prepare: hooks, Prisma client generation, tsc build

:: tip The repository pins npm lifecycle scripts through the allowScripts field — only approved native packages (Prisma, better-sqlite3, esbuild, SWC, …) may run install scripts. :::

Verify the setup ​

bash
npm run typecheck      # tsc -b across workspaces
npm run build          # build all packages
npm test               # run every workspace test suite
npm run validate       # format check + lint + tests

Common scripts ​

ScriptPurpose
npm run dev:apiStart the API in watch mode
npm run dev:workersStart BullMQ workers in watch mode
npm run start:apiRun the built API
npm run benchRun evaluator/API benchmark suite
npm run test:quickEngine, evaluator, types and SDK tests only
npm run lint / lint:fixESLint across .ts sources
npm run format:checkPrettier check (part of validate / precommit)
npm run db:migrateReviewed PostgreSQL migrations (API)
npm run db:seedSeed the database
npm run e2e:dockerDocker Compose + Anvil end-to-end suite
npm run deploy:prodCompose production deployment
npm run db:backupTrigger the backup container inside compose

First steps per package ​

GoalJump to
Score a poker handEvaluator Quick Start
Simulate a full handEngine Quick Start
Call the API from TypeScriptSDK Quick Start
Run the full-stack APIAPI setup
Deploy the stackDeployment guide

Pre-commit hooks ​

The repository enables its own hooks directory during npm install:

bash
git config core.hooksPath   # => .githooks

The pre-commit hook runs format:check, lint and the quick test suite, so committing is safe even without a local CI run.

Troubleshooting ​

SymptomCause & fix
ECONNREFUSED at 127.0.0.1:6379Redis isn't running. Run npm run infra:up -w @pokertools/api (starts a local daemon in .runtime/) or start your own. API tests auto-start Redis via pretest.
Could not locate the bindings file (better-sqlite3)Check the exact native dependency version and its reviewed install-script permission, then run npm ci. Prisma's adapter may require a different supported major; do not force native versions together with overrides.
Version mismatch errors from workersExpected: a stale scheduled job raced a player action. The job is retried by BullMQ; if it persists, check that only one worker process per queue is running.
npm install reports blocked install scriptsNew native packages must be added to allowScripts in the root package.json, then re-run npm install.
prisma db push fails with NOT NULL driftAutomatic preparation never accepts data loss or resets a caller-supplied database. Explicitly recreate only a verified disposable SQLite fixture. PostgreSQL always uses npm run db:migrate, never prisma db push.
SDK requests hangCheck timeout config (default 30 s) and that baseUrl is reachable. Mutation retries require a server-recognized operation identity or an explicitly documented naturally idempotent resource operation.
Forge tests fail to compileRun npm run contracts:build -w @pokertools/custody, or install Foundry via foundryup.

Released under the MIT License.