Overview

Poker Engine is a server-authoritative real-time poker platform. A single Node.js process runs the REST API, the WebSocket server, the in-memory game tables and the background services. PostgreSQL holds persistent state. Clients only render what the server sends: cards, stacks, pots and action validity are all decided on the server.

System Components

ComponentLocationResponsibility
Game enginesrc/game/Cards, hand evaluation, betting rules, pots, rake, showdown, and the table lifecycle for every variant
WebSocket serversrc/websocket/Bridges table events to clients: public broadcasts, private prompts, personalized snapshots and sequence-aware resync
REST APIsrc/api/routes/Accounts, lobby, cashier, tournaments, admin and integration endpoints
Servicessrc/services/Business logic and persistence: wallets, tournaments, sessions, payments, settings
Databaseprisma/schema.prismaPostgreSQL through Prisma; schema changes ship as migrations
Bot systemsrc/game/bot/Bot players, decision strategies and the table-fill scheduler
Web clientclient/src/Lobby, Table V2, cashier, profile and admin panel
Shared packagepackages/shared/src/Types, stores and sequence-tracking helpers used by clients and server

How a Hand Flows Through the System

  1. A player action arrives over the WebSocket connection and is validated against the live table.
  2. The in-memory Table in src/game/table/ applies it and advances the betting round, deals the next street, or runs the showdown.
  3. The table emits game events. The WebSocket layer turns them into public broadcasts and private, guaranteed-delivery messages such as hole_cards and action_required.
  4. When the hand finishes, chips are settled at the table and the hand result is persisted by the services layer.
  5. A client that reconnects or detects a sequence gap sends request_table_state to get an authoritative snapshot back.

Hands in progress live in memory, so the table process is stateful. Money movement is not: wallet and tournament prize changes go through database transactions.

Key Principles

  • Server authority. The server evaluates cards and enforces betting rules. Clients never decide an outcome.
  • Integer chips at the table, decimals in the ledger. Game logic works in whole chips. Wallets and ledger rows use Decimal(18,2).
  • Rule profiles. Cash, private and tournament behaviour resolves through versioned rule profiles in src/services/rule-profile.service.ts.
  • Database-backed settings. Game settings, feature toggles, SMTP and payment configuration are managed from the Admin Panel, not environment variables.

Key Architecture Documents

Try the live demo Pricing

Have questions about Poker Engine? We reply fast.