A production-ready, provably fair casino platform built with modern technologies, featuring 20+ games, multi-currency support, advanced betting strategies, and real-time multiplayer games.
- โ 20+ Casino Games - Dice, Limbo, Crash, Mines, Plinko, Roulette, Keno, Wheel, and more
- โ Provably Fair System - Stake-style RNG with HMAC-SHA256
- โ Multi-Currency Wallet - BTC, ETH, LTC, USDT, USD, EUR
- โ Manual & Auto Betting - Advanced autobet with stop conditions
- โ Strategy Engine - Martingale, Paroli, D'Alembert, custom scripts
- โ Jackpot System - Configurable per game/currency
- โ Contest System - Daily/weekly competitions
- โ Leaderboards - High rollers, big wins, lucky wins
- โ VIP & Rakeback - Reward loyal players
- โ Real-time Multiplayer - Crash, Trenball with Socket.IO
- โ Fairness Verification - Complete verifier page
- โ Admin Panel - Manage games, jackpots, contests
- ๐ JWT Authentication with RBAC
- ๐ PostgreSQL + Prisma ORM
- ๐ Redis + BullMQ for workers
- ๐ Socket.IO for real-time games
- ๐จ Retro modern UI with Tailwind
- ๐ฑ Responsive design
- ๐ Monorepo architecture
casino-platform/
โโโ apps/
โ โโโ backend/ # Fastify API + WebSocket server
โ โ โโโ src/
โ โ โ โโโ routes/ # API endpoints
โ โ โ โโโ services/ # Business logic
โ โ โ โโโ workers/ # Background jobs
โ โ โ โโโ websocket/# Real-time games
โ โ โโโ package.json
โ โโโ frontend/ # Next.js application
โ โโโ src/
โ โ โโโ app/ # Pages
โ โ โโโ components/# UI components
โ โ โโโ store/ # Zustand state
โ โ โโโ lib/ # API client
โ โโโ package.json
โโโ packages/
โ โโโ database/ # Prisma schemas
โ โโโ game-engine/ # Game logic
โ โโโ fairness/ # RNG system
โ โโโ shared/ # Shared types
โโโ docs/ # Documentation
- Node.js 18+
- PostgreSQL 14+
- Redis 6+
- npm or yarn
- Clone the repository
git clone <repository-url>
cd casino-platform- Install dependencies
npm install- Setup environment variables
Create .env files in both apps/backend and apps/frontend:
Backend .env:
DATABASE_URL="postgresql://user:password@localhost:5432/casinobit"
REDIS_HOST="localhost"
REDIS_PORT="6379"
JWT_SECRET="your-super-secret-jwt-key-change-this"
PORT="3001"
FRONTEND_URL="http://localhost:3000"Frontend .env.local:
NEXT_PUBLIC_API_URL="http://localhost:3001"- Setup database
npm run db:generate
npm run db:push- Start development servers
npm run devThis will start:
- Backend API: http://localhost:3001
- Frontend: http://localhost:3000
- Dice - Roll over/under with ultimate mode
- Limbo - Exponential multiplier prediction
- Mines - Grid-based mine sweeper
- Plinko - Ball drop with risk levels
- Crash - Multiplayer crash game
- Roulette - European roulette with presets
- Keno - Number selection game
- Wheel - Spin wheel with segments
- Trenball - Color betting multiplayer
Each game includes:
- Provably fair RNG
- Configurable house edge
- Min/max bet limits
- Jackpot conditions
- Demo mode
- Auto-bet support
- Strategy compatibility
- Server Seed - Generated and hashed before betting
- Client Seed - User-provided or auto-generated
- Nonce - Increments with each bet
- Cursor - For generating unlimited bytes
// Generate HMAC
const hmac = HMAC_SHA256(serverSeed, `${clientSeed}:${nonce}:${cursor}`);
// Convert to bytes
const bytes = Buffer.from(hmac, 'hex');
// Generate floats (0-1)
const float = bytes.readUInt32BE(0) / 0x100000000;
// Map to game events
const result = mapToGameEvent(float);Users can verify any bet by:
- Viewing the seed pair used
- Checking the server seed hash
- Rotating seeds to reveal server seed
- Using the verifier page to recalculate
- User - Authentication and profile
- Wallet - Multi-currency balances
- SeedPair - Provably fair seeds
- Bet - Bet history and results
- Jackpot - Jackpot pools
- Contest - Competition data
- Strategy - Betting strategies
POST /api/auth/register- Register new userPOST /api/auth/login- LoginGET /api/auth/me- Get current user
POST /api/bet/place- Place a betGET /api/bet/history- Get bet historyPOST /api/bet/autobet/start- Start autobetPOST /api/bet/autobet/stop- Stop autobet
GET /api/wallet- Get all walletsPOST /api/wallet/add- Add balance
GET /api/seed/active- Get active seed pairPOST /api/seed/client-seed- Update client seedPOST /api/seed/rotate- Rotate seed pair
GET /api/game- List all gamesPOST /api/game/:gameType/favorite- Toggle favorite
GET /api/strategy/defaults- Get default strategiesPOST /api/strategy- Create strategyGET /api/strategy/public- Browse public strategies
GET /api/leaderboard/all-bets- Recent betsGET /api/leaderboard/high-rollers- Highest betsGET /api/leaderboard/big-wins- Biggest winsGET /api/leaderboard/lucky-wins- Highest multipliers
/- Homepage with game grid/game/[gameType]- Individual game pages/wallet- Wallet management/history- Bet history/leaderboard- Leaderboards/contests- Active contests/fairness- Fairness explanation/verifier- Bet verifier/admin- Admin panel
BetControls- Amount input, presets, auto-betFairnessModal- Seed managementLiveStats- Real-time statisticsGameCanvas- Game visualizationLeaderboard- Bet listings
Admins can configure per game:
- House edge percentage
- Min/max bet per currency
- Max win per currency
- Jackpot conditions
- Enable/disable game
- Per game or global
- Per currency or all currencies
- Minimum amount threshold
- Contribution percentage
- Win conditions
- Duration (daily/weekly)
- Prize pool
- Entry requirements
- Ranking criteria
- Prize distribution
# Build all packages
npm run build
# Start production servers
npm run start- Setup PostgreSQL database
- Setup Redis instance
- Configure environment variables
- Run database migrations
- Start backend and frontend
- Hosting: AWS, DigitalOcean, or Vercel
- Database: AWS RDS or managed PostgreSQL
- Redis: AWS ElastiCache or Redis Cloud
- CDN: CloudFlare
- Monitoring: Sentry, DataDog
# Run tests (when implemented)
npm test
# Run linting
npm run lintDouble bet after loss, reset after win
Double bet after 3 consecutive losses
Double bet after win, reset after loss
Double bet after win, reset after 3 wins
Increase by 10% after loss, decrease by 10% after win
- Real-time multiplier growth
- Auto cashout support
- Round history
- Player list
- Bet on crash/red/green/moon
- Round-based gameplay
- Color statistics
- JWT authentication
- Password hashing with bcrypt
- CORS protection
- Rate limiting (recommended)
- Input validation with Zod
- SQL injection protection (Prisma)
- XSS protection
- Redis caching
- Database indexing
- Connection pooling
- Worker queues for heavy tasks
- Optimized queries
Colors are defined in:
packages/shared/constants.tsapps/frontend/tailwind.config.jsapps/frontend/src/styles/globals.css
- Fork the repository
- Create feature branch
- Commit changes
- Push to branch
- Open pull request
MIT License - see LICENSE file
For issues and questions:
- GitHub Issues
- Documentation
- Community Discord
- More games (Blackjack, HiLo, Tower, etc.)
- Mobile app
- Live dealer games
- Sports betting
- NFT integration
- Tournament system
- Affiliate program
- Multi-language support
Built with โค๏ธ using Node.js, TypeScript, Next.js, and PostgreSQL