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.
System Architecture
A viable low-cost architecture for regulated iGaming using Cloudflare Workers, KV, D1 and Durable Objects. Demonstrated as a complete alternative to traditional infrastructure — ideal for startups and emerging markets like Brazil (.bet.br). See Chapter 46: Complete Brazilian Betting Platform in The Backend of Luck.
Domain Modules
Registration, JWT authentication (access + refresh tokens), player profiles with KYC status and VIP tier tracking.
Append-only event log: BET, WIN, DEPOSIT, WITHDRAWAL, BONUS_CREDIT, BONUS_DEBIT. Balance computed from events, never updated directly.
Game sessions, server-side CSPRNG bet resolution, RNG seed hash audit trail. Integrates with wallet for atomic bet/win.
KYC document submission and operator verification, AML velocity-based alerts with risk scoring (low/medium/high/critical).
Player deposit limits (daily/weekly/monthly), self-exclusion with enforced cooling-off, reality checks with net position tracking.
Server-side RTP configuration (80-99%) per game, aggregate statistics, actual vs target RTP deviation tracking.
How This Platform Works
A microservices architecture with Python and Go services, Kafka KRaft event streaming, and Cloudflare Workers edge deployment. Nine bounded contexts handle every domain of regulated iGaming operations, including Brazilian betting under Lei 14.790/2023.
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.
Fraud Detection Pipeline
A real-time fraud detection and analytics pipeline built on a Kubernetes cluster. Wallet events are collected, scored by a rules engine, and streamed through Kafka into a full analytics stack for batch ML and compliance reporting.
1.9K+ fraud alerts
durable streaming
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.
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.
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.
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.
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.
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.
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.
Live Data Right Now
Real-time statistics fetched directly from the platform API.
Frequently Asked Questions
Python 3.12 and FastAPI for the backend, PostgreSQL for persistent storage, Redis (small/medium scale) for cache, locks, and transient fan-out, Kafka KRaft (enterprise) for durable event streaming, and Docker Compose for orchestration. The frontend uses vanilla HTML/CSS/JavaScript with no framework dependencies. API documentation is auto-generated via Swagger/OpenAPI.