The Backend of LuckTrainingRoadmaps

iGaming on Cloudflare Workers (Chapter 44)

iGaming on Cloudflare Workers (Chapter 44) An architecture diagram generated by Archify. Players · browser · native · B2B · Architecture component Players browser · native · B2B Pages lobbies · casino · cfgp · bet-brazil · Cloudflare account · static Pages lobbies casino · cfgp · bet-brazil static Cloudflare Edge · DDoS + WAF, 300+ PoPs · Cloudflare account Cloudflare Edge DDoS + WAF, 300+ PoPs Security Pipeline · threat · bot · geo · rate · Cloudflare account · 403 / 451 / 429 Security Pipeline threat · bot · geo · rate 403 / 451 / 429 acmetocasino-api · Worker, V8 isolate · Cloudflare account › per-brand Worker + bindings (wrangler.<brand>.toml) · no cold start acmetocasino-api Worker, V8 isolate no cold start D1 · serverless SQLite, 9 tables · Cloudflare account › per-brand Worker + bindings (wrangler.<brand>.toml) · location hint D1 serverless SQLite, 9 tables location hint KV SESSIONS / CACHE · refresh tokens, 30-day TTL · Cloudflare account › per-brand Worker + bindings (wrangler.<brand>.toml) KV SESSIONS / CACHE refresh tokens, 30-day TTL R2 kyc-docs · KYC document objects · Cloudflare account › per-brand Worker + bindings (wrangler.<brand>.toml) R2 kyc-docs KYC document objects Game Providers · NetEnt · Evolution · Pragmatic · Architecture component Game Providers NetEnt · Evolution · Pragmatic Self-exclusion / AML · OASIS · CRUKS · Spelpaus · Architecture component Self-exclusion / AML OASIS · CRUKS · Spelpaus PSPs · Trustly · Stripe · Skrill · Architecture component PSPs Trustly · Stripe · Skrill HTTPS, auto TLS lobby HTML route /* dispatch /api/* SQL binding session read / write PUT document launch + round callbacks HTTPS lookup HMAC webhook + Idempotency-Key Cloudflare account per-brand Worker + bindings (wrangler.<brand>.toml) Legend Frontend Database Cloud Security External

Edge Decisions

  • • cf.threat_score > 50 → 403, bot score < 20 → 403
  • • Blocked jurisdiction → 451, over 200 req/min → 429
  • • Rate counters live in a per-isolate Map to stay inside free-tier KV writes

Brand Isolation

  • • One TypeScript codebase deployed as one Worker per brand
  • • Each brand has its own D1, KV, R2 and JWT_SECRET: tokens cannot cross brands
  • • D1 location hints keep EU, UK and US-NJ player data in region

Live Proof

  • • cfgp.cloud-acmetocasino.com runs roulette, blackjack and video poker on this flow
  • • Raw card data never reaches the Worker: PSP hosted fields keep PCI scope small
  • • Terraform owns DNS, Wrangler owns deploys and rollback is one command