Build a scalable, production-ready social sweepstakes casino platform with dual-currency functionality (Gold Coins and Sweeps Coins), a full suite of casino and instant win games, AI-powered game creation tools, real-time multiplayer systems, payment integration, and a comprehensive admin panel.

The system must be modular, secure, legally compliant, and designed for high scalability and continuous content expansion.

1. Core Platform Architecture
Use a modular, service-oriented or microservices architecture
Separate services for:
Authentication
Wallet & ledger
Game engine
Payments (Square API integration)
Admin panel
AI Game Builder
Ensure:
API-first design
Horizontal scalability
Secure communication between services
2. User Accounts & Identity
Secure authentication (JWT or OAuth)
Email verification and password recovery
Optional 2FA
User profiles:
Avatars
Preferences
Gameplay history
Device/session tracking for fraud prevention
Optional KYC system for Sweeps Coin redemption
3. Dual Currency Wallet System

Implement two currencies:

Gold Coins (GC)
Non-redeemable
Used for fun play
Sweeps Coins (SC)
Redeemable under sweepstakes rules
Wallet Features:
Real-time balance updates
Full transaction ledger:
Purchases (GC)
SC bonuses
Bets
Wins
Redemptions
Audit logs and rollback capability
Currency isolation (no mixing rules)
4. Store & Payment Integration
Build a Gold Coin storefront
Integrate Square API:
Checkout
Payment processing
Webhooks
Automatically grant SC as a promotional bonus with purchases
Implement fraud checks and validation
Never sell SC directly
5. Game Engine System
Slot Engine:
Build reusable HTML5 engine (Phaser.js or similar)
Support:
50+ themed slot games
Configurable reels, paylines
RTP and volatility settings
Bonus rounds, scatters, free spins
Use data-driven configs (JSON-based)
Additional Games:
Arcade-style JS games
Crash / plinko-style games
Scratch tickets and pull tabs (see section 6)
All games must:
Connect to wallet
Use secure RNG (provably fair or auditable)
6. Branded Instant Win Games (Scratch & Pull Tabs)

Develop a modular instant win system:

Features:
Scratch-off tickets (grid reveal)
Pull-tab instant win tickets
Fully branded:
Themes
Symbols
Animations
Sounds
Admin Controls:
Create/edit ticket templates
Configure:
Win probabilities
Prize tiers
Ticket cost (SC)
Promotional overlays
Scheduling system:
Seasonal games
Limited-time drops
Backend Logic:
Use pre-generated ticket pools or secure RNG
Ensure precise RTP control
Instant SC payout on win
7. Multiplayer & Real-Time Systems

Use WebSockets for real-time gameplay:

Poker (cash + tournaments)
Bingo rooms with scheduled draws
1v1 Pool hall with physics engine

Requirements:

Server-authoritative logic
Anti-cheat validation
Real-time synchronization