Architecture-Aligned with The Backend of Luck

AcmeToCasino Dev Platform

A production-grade modular monolith for iGambling, built with FastAPI and domain-driven design. Server-side RNG, event-sourced wallet, KYC/AML compliance, and responsible gaming controls.

Checking...
database Database: ...
storage Redis: ...
Last check: --
hub

System Architecture

BROWSER
Dashboard / Game UI
API GATEWAY
Nginx + TLS
FastAPI Modular Monolith
Domain-driven design
PAM
/players, /auth/*
WALLET
/wallet/*
GAL
/gal/*
COMPLIANCE
/compliance/*
RESP. GAMING
/responsible-gaming/*
GAME CTRL
/game-control/*
database PostgreSQL
storage Redis Pub/Sub
grid_view

Domain Modules

person
Online
Player Account Management
/players, /auth/*

Registration, JWT authentication (access + refresh tokens), player profiles with KYC status and VIP tier tracking.

Endpoints
POST/players
GET/players/{id}
POST/auth/login
POST/auth/refresh
account_balance_wallet
Online
Event-Sourced Wallet
/wallet/{player_id}/*

Append-only event log: BET, WIN, DEPOSIT, WITHDRAWAL, BONUS_CREDIT, BONUS_DEBIT. Balance computed from events, never updated directly.

Endpoints
GET/wallet/{id}/balance
POST/wallet/{id}/transaction
GET/wallet/{id}/history
casino
Online
Game Aggregation Layer
/gal/*

Game sessions, server-side CSPRNG bet resolution, RNG seed hash audit trail. Integrates with wallet for atomic bet/win.

Endpoints
POST/gal/launch
POST/gal/bet
GET/gal/sessions/{id}
verified_user
Online
Compliance (KYC / AML)
/compliance/*

KYC document submission and operator verification, AML velocity-based alerts with risk scoring (low/medium/high/critical).

Endpoints
POST/compliance/kyc/{id}/submit
POST/compliance/kyc/{id}/verify
GET/compliance/aml/alerts
schedule
Online
Responsible Gaming
/responsible-gaming/*

Player deposit limits (daily/weekly/monthly), self-exclusion with enforced cooling-off, reality checks with net position tracking.

Endpoints
POST/responsible-gaming/limits/{id}
POST/responsible-gaming/exclude/{id}
GET/responsible-gaming/status/{id}
settings_suggest
Online
Game Control
/game-control/*

Server-side RTP configuration (80-99%) per game, aggregate statistics, actual vs target RTP deviation tracking.

Endpoints
GET/game-control/rtp
PUT/game-control/rtp/{slug}
GET/game-control/stats
layers

How This Platform Works

A modular monolith architecture with six bounded contexts, each responsible for a distinct domain of iGambling operations. Every module communicates through well-defined internal APIs.

Request Flow: Player to Database

Every request passes through the API gateway, gets routed to the correct domain module, and interacts with shared data stores.

Client
computer
DASHBOARD
Operator UI
sports_esports
GAME UI
Player-facing
description
SWAGGER
API Explorer
Gateway
security
NGINX + TLS
Reverse proxy
bolt
FASTAPI
ASGI Router
Modules
PAM
Players & Auth
WALLET
Transactions
GAL
Game Engine
COMPLIANCE
KYC / AML
RESP. GAMING
Player Safety
GAME CTRL
RTP Config
Data
database
POSTGRESQL
Persistent storage
storage
REDIS
Cache & Pub/Sub
menu_book
Chapter 10: Complete Platform Architecture covers the full production topology -- from edge CDN through service mesh to database clusters across jurisdictions. Read in The Backend of Luck →
developer_board

Module Deep Dives

Click any module to expand its details, see available endpoints, and find the corresponding book chapters.

Handles player registration, JWT-based authentication (access + refresh tokens), KYC document verification, player profile management, and VIP tier tracking. Every player interaction starts here.

Key Endpoints
POST/pam/register
POST/pam/login
GET/pam/players
GET/pam/players/{id}
menu_book
Chapters 10 & 24: Platform Architecture & Security Compliance. Get the book →

Manages deposits, withdrawals, bet/win transactions, and real-time balance computation. Uses an append-only event log -- balances are derived from the event stream, never updated directly. Supports BET, WIN, DEPOSIT, WITHDRAWAL, BONUS_CREDIT, and BONUS_DEBIT event types.

Key Endpoints
GET/wallet/{player_id}/balance
POST/wallet/deposit
GET/wallet/recent-events
GET/wallet/{player_id}/history
menu_book
Chapter 12: Real-Time Cash Flow Management -- event sourcing, double-entry accounting, and reconciliation. Get the book →

Provides a unified game API that abstracts multiple providers behind a single interface. Manages game sessions, server-side CSPRNG-based bet resolution, RNG seed hash audit trails, and atomic bet/win transactions with the wallet module.

Key Endpoints
POST/gal/play
GET/gal/games
GET/gal/recent-rounds
POST/gal/launch
menu_book
Chapters 15 & 17: Casino Mathematics & Random Number Generation -- how the house edge works, RNG certification, and provably fair gaming. Get the book →

Manages KYC document submission and operator-side verification, AML velocity-based alerts with risk scoring (low/medium/high/critical), regulatory reporting pipelines, and jurisdiction-specific compliance rules. Integrates with national exclusion databases.

Key Endpoints
POST/compliance/kyc/verify
GET/compliance/kyc/{player_id}
GET/compliance/aml/alerts
POST/compliance/aml/alerts/{id}/review
menu_book
Chapters 24-25: Security & GLI/GSF Compliance -- encryption at rest, PCI-DSS, and regulatory framework across 100+ jurisdictions. Get the book →

Enforces deposit limits (daily/weekly/monthly), session time limits, self-exclusion with mandatory cooldown periods, and behavioral alerts. Monitors real-time player activity to detect harmful patterns and trigger graduated interventions.

Key Endpoints
POST/responsible-gaming/limits
GET/responsible-gaming/limits/{player_id}
POST/responsible-gaming/exclude/{id}
GET/responsible-gaming/status/{id}
menu_book
Chapter 26: Responsible Gaming & Player Protection -- real-time behavioral monitoring, ML-driven addiction detection, and GAMSTOP integration. Get the book →

Server-side RTP management (configurable 80-99% per game), aggregate game statistics, actual vs target RTP deviation tracking, and operator-level controls for game performance tuning. The operator's lever for managing the house edge.

Key Endpoints
GET/game-control/rtp
PUT/game-control/rtp/{slug}
GET/game-control/stats
menu_book
Chapters 15 & 28: Casino Mathematics & Technical Deep Dives -- house edge mechanics, volatility models, and RTP certification. Get the book →
auto_stories Companion Demo

Built from The Backend of Luck

This platform is a working demonstration of the architecture described in the book "The Backend of Luck: Inside the Systems That Power Real Money Gaming". Every module, endpoint, and data flow you see here maps directly to a book chapter.

53
Chapters
478K+
Words
920+
Production Scripts
282+
Diagrams
menu_book Get the Book
monitoring

Live Data Right Now

Real-time statistics fetched directly from the platform API.

group
Loading...
Players Registered
sports_esports
Loading...
Game Rounds Played
percent
Loading...
Platform RTP
casino
Loading...
Total Games Available
help

Frequently Asked Questions

No. This is a simulation platform built as a companion to the book The Backend of Luck. No real money is involved. All players are simulated, all transactions are fake, and the platform exists purely to demonstrate how a production iGambling backend works under the hood. Think of it as a fully functional prototype for educational purposes.
The architecture patterns demonstrated here are production-grade -- modular monolith with domain-driven design, event-sourced wallet, server-side RNG, and compliance modules. However, this is a demonstration platform. A production deployment would require hardened security, load testing, jurisdiction-specific licensing, third-party KYC provider integration, and regulatory certification. The book covers all of these requirements in detail across 53 chapters.
The platform is built with Python 3.12 and FastAPI for the backend, PostgreSQL for persistent storage, Redis for caching and pub/sub, and Docker Compose for orchestration. The frontend uses vanilla HTML/CSS/JavaScript with no framework dependencies. API documentation is auto-generated via Swagger/OpenAPI.
Visit /api/v2/docs for the full interactive Swagger/OpenAPI documentation. You can explore every endpoint, see request/response schemas, and execute test calls directly from your browser. The alternative ReDoc view is also available at /api/v2/redoc.
The operational dashboard is at dashboard.html. It provides real-time visibility into player activity, wallet transactions, game rounds, RTP performance, compliance alerts, and responsible gaming metrics. The dashboard has 17 tabs covering every aspect of platform operations -- the same data an operator would monitor in production.