A Modern Multi-Chain Crypto Gaming Platform with Real-Time Multiplayer Games
Scissors • Crash • Mines • Turtle Race • Plinko • Dice • Slot Game
Features • Quick Start • Architecture • Documentation • Contributing
- Overview
- Features
- Games
- Architecture
- Tech Stack
- Quick Start
- Configuration
- Project Structure
- API Documentation
- Security
- Development
- Deployment
- Troubleshooting
- Contributing
- License
A comprehensive, production-ready crypto gaming platform built with modern technologies. This platform supports multiple blockchain networks, provides real-time multiplayer gaming experiences, and includes a complete admin dashboard for platform management.
- 🎮 7 Different Games - Crash, Dice, Mines, Scissors, Slot, Plinko, Turtle Race
- 🔗 Multi-Chain Support - Ethereum, BSC, Tron, Bitcoin
- 💰 Multiple Cryptocurrencies - BTC, ETH, BNB, TRX, USDT, and more
- ⚡ Real-Time Gaming - Socket.IO powered live gameplay
- 🔐 Secure Authentication - JWT, 2FA, Web3 wallet integration
- 📊 Admin Dashboard - Complete platform management
- 🐳 Docker Ready - One-command deployment
- 📈 Scalable Architecture - Microservices design
- ✅ Real-time multiplayer gameplay with Socket.IO
- ✅ Provably fair gaming with seed-based randomness
- ✅ Instant game results and payouts
- ✅ Game history and statistics
- ✅ Tournament system
- ✅ Free spins and rewards
- ✅ Multi-currency wallet support
- ✅ Deposit and withdrawal functionality
- ✅ Real-time balance updates
- ✅ Transaction history
- ✅ Multi-chain token support
- ✅ Automatic transaction monitoring
- ✅ Multiple authentication methods (Email, Google OAuth, Web3 wallet)
- ✅ User profile management
- ✅ Game settings and preferences
- ✅ Betting history and statistics
- ✅ Affiliate program support
- ✅ Real-time chat system
- ✅ Comprehensive admin dashboard
- ✅ User management and moderation
- ✅ Game configuration
- ✅ Transaction monitoring
- ✅ Analytics and reporting
- ✅ Campaign management
- ✅ System health monitoring
- ✅ Centralized Logging - Structured logging with file and console output
- ✅ Health Checks - Built-in health endpoints for all services
- ✅ Rate Limiting - Protection against abuse and DDoS
- ✅ Error Handling - Comprehensive error handling middleware
- ✅ Docker Support - Complete containerization setup
- ✅ Environment Variables - Secure configuration management
- ✅ API Documentation - Complete API reference
| Game | Description | Features |
|---|---|---|
| 🎯 Crash | Bet before the graph crashes! | Multiplier mechanics, auto-cashout, live betting |
| 🎲 Dice | Traditional luck-based dice game | Customizable odds, instant results |
| 💣 Mines | Find safe spots, avoid bombs! | Progressive difficulty, strategic gameplay |
| ✂️ Scissors | Classic multiplayer hand game | Real-time betting, instant payouts |
| 🎰 Slot | Spin the reels, win rewards! | Multiple themes, bonus rounds |
| 🎪 Plinko | Drop the ball, win prizes! | Physics-based gameplay, multiple levels |
| 🐢 Turtle Race | Race to win! | Multiple participants, dynamic odds |
┌─────────────────────────────────────────────────────────────┐
│ Frontend (React) │
│ Port: 8800 │
└──────────────────────┬──────────────────────────────────────┘
│
┌──────────────────────┴──────────────────────────────────────┐
│ API Gateway / Load Balancer │
└──────────────────────┬──────────────────────────────────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌───────▼──────┐ ┌─────▼─────┐ ┌─────▼──────┐
│ Main Server │ │ Management │ │ Admin │
│ Port: 5000 │ │ Port: 4000 │ │ Port: 6100│
└───────┬──────┘ └─────┬─────┘ └─────┬──────┘
│ │ │
└──────────────┼──────────────┘
│
┌──────────────┼──────────────┐
│ │ │
┌───────▼──────┐ ┌─────▼─────┐ ┌─────▼──────┐
│ Game Services│ │ Chat │ │ MongoDB │
│ Ports: 5100+ │ │ Port:4900 │ │ Database │
└──────────────┘ └───────────┘ └────────────┘
The platform uses a microservices architecture where each game and major functionality runs as an independent service:
- Main Server (5000) - Core API, authentication, payments
- Admin Service (6100) - Admin panel backend
- Management Service (4000) - Platform management, analytics
- Chat Service (4900) - Real-time chat system
- Game Services (5100-5700) - Individual game servers with Socket.IO
Each service:
- Operates independently
- Has its own health check endpoint
- Can be scaled horizontally
- Connects to shared MongoDB database
- Uses centralized logging
- Runtime: Node.js 18+
- Framework: Express.js
- Database: MongoDB 7.0 with Mongoose ODM
- Real-Time: Socket.IO 4.5+
- Authentication: JWT (JSON Web Tokens)
- Blockchain: Web3.js, Ethers.js, TronWeb
- Payments: Tatum API for crypto transactions
- Email: SendGrid for transactional emails
- Task Scheduling: node-cron
- Logging: Custom centralized logger
- Rate Limiting: express-rate-limit
- Framework: React 18.2.0
- State Management: Redux with Redux Thunk
- UI Library: Material-UI (MUI) 5.0
- Routing: React Router DOM 6.0
- Web3 Integration: @web3-react/core, Ethers.js
- Real-Time: Socket.IO client
- HTTP Client: Axios
- Build Tool: react-app-rewired with custom webpack config
- Containerization: Docker & Docker Compose
- Web Server: Nginx (for production frontend)
- Process Management: PM2 (optional)
- Version Control: Git
- Node.js v18 or higher
- MongoDB 7.0+ (local or MongoDB Atlas)
- npm or yarn package manager
- Docker and Docker Compose (for Docker deployment)
- Git for version control
The easiest way to get started is using Docker Compose:
# Clone the repository
git clone <repository-url>
cd solana-casino-game-master
# Copy environment files (if needed)
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
cp admin/.env.example admin/.env
# Edit .env files with your configuration
# Then start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose downServices will be available at:
- Frontend: http://localhost:8800
- Admin Panel: http://localhost:9000
- Main API: http://localhost:5000
- Health Checks: http://localhost:5000/health
git clone <repository-url>
cd solana-casino-game-mastercd backend
# Install dependencies
npm install --legacy-peer-deps
# Create .env file (copy from .env.example)
cp .env.example .env
# Edit .env with your configuration
# Then start the main server
npm run dev
# In separate terminals, start other services:
npm run admin # Admin service (port 6100)
npm run manage # Management service (port 4000)
npm run chatroom # Chat service (port 4900)
npm run crash # Crash game (port 5700)
npm run dice # Dice game (port 5400)
npm run mines # Mines game (port 5300)
npm run scissors # Scissors game (port 5200)
npm run slot # Slot game (port 5500)
npm run plinko # Plinko game (port 5600)
npm run turtle # Turtle race (port 5100)cd frontend
# Install dependencies
npm install --legacy-peer-deps
# Create .env file (optional)
cp .env.example .env
# Start development server
npm startFrontend will be available at http://localhost:8800
cd admin
# Install dependencies
npm install
# Create .env file (optional)
cp .env.example .env
# Start admin panel
npm startAdmin panel will be available at http://localhost:9000
Create a .env file in the backend directory:
# Server Configuration
SERVER_PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/PlayZelo
# Or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://user:[email protected]/PlayZelo
# JWT Authentication
JWT_SECRET=your_strong_random_secret_key_min_32_chars
JWT_EXPIRE=1h
# Tatum API (Crypto Payments)
TATUM_API_KEY_TESTNET=your_testnet_api_key
TATUM_API_KEY_MAINNET=your_mainnet_api_key
# Infura (Ethereum Provider)
INFURA_API_KEY=your_infura_api_key
INFURA_URL_TESTNET=https://sepolia.infura.io/v3/YOUR_KEY
INFURA_URL_MAINNET=https://mainnet.infura.io/v3/YOUR_KEY
# Network Configuration
NETWORK=testnet
DEV_MODE=true
# Email Service (SendGrid)
SENDGRID_API_KEY=your_sendgrid_api_key
# CORS
CORS_ORIGIN=http://localhost:8800,http://localhost:9000
# Logging
LOG_LEVEL=info
LOG_FILE_PATH=./logsREACT_APP_API_URL=http://localhost:5000/api
REACT_APP_SOCKET_URL=http://localhost:4000
REACT_APP_CHAT_SOCKET_URL=http://localhost:4900
REACT_APP_GOOGLE_CLIENT_ID=your_google_client_idREACT_APP_API_URL=http://localhost:6100/api
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change_this_password.env files. Always use .env.example as a template.
solana-casino-game-master/
├── backend/ # Backend services
│ ├── server.js # Main server entry point
│ ├── config.js # Configuration (uses env vars)
│ ├── controllers/ # Request handlers
│ ├── models/ # Database models
│ ├── routes/ # API routes
│ ├── middleware/ # Express middleware
│ ├── utils/ # Shared utilities
│ │ ├── logger.js # Centralized logging
│ │ ├── appFactory.js # App factory (reduces duplication)
│ │ ├── rateLimiter.js # Rate limiting
│ │ └── errorHandler.js # Error handling
│ ├── helper/ # Helper functions
│ ├── crash/ # Crash game service
│ ├── dice/ # Dice game service
│ ├── mines/ # Mines game service
│ ├── scissors/ # Scissors game service
│ ├── slot/ # Slot game service
│ ├── plinko/ # Plinko game service
│ ├── turtlerace/ # Turtle race service
│ ├── userchat/ # Chat service
│ ├── management/ # Management service
│ └── admin/ # Admin service
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── App.js # Main app component
│ │ ├── config/ # Configuration files
│ │ ├── redux/ # Redux store and reducers
│ │ ├── routes/ # Route definitions
│ │ ├── views/ # Page components
│ │ ├── layout/ # Layout components
│ │ └── assets/ # Static assets
│ └── public/ # Public assets
│
├── admin/ # Admin panel
│ └── src/ # Admin React app
│
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Backend Dockerfile
├── .dockerignore # Docker ignore file
├── .gitignore # Git ignore file
├── README.md # This file
└── API.md # API documentation
Complete API documentation is available in API.md.
Base URL: http://localhost:5000/api
Authentication:
Authorization: Bearer <jwt_token>Health Check:
GET /healthKey Endpoints:
POST /api/v0/auth/register- Register userPOST /api/v0/auth/login- LoginGET /api/v0/user/profile- Get user profileGET /api/v0/wallet/balance- Get wallet balancePOST /api/v0/wallet/deposit- Deposit fundsPOST /api/v0/wallet/withdraw- Withdraw fundsPOST /api/v0/games/bet- Place bet
See API.md for complete documentation.
- ✅ JWT Authentication - Secure token-based authentication
- ✅ Password Hashing - Bcrypt with salt rounds
- ✅ Rate Limiting - Protection against abuse and DDoS
- ✅ CORS Protection - Configurable Cross-Origin Resource Sharing
- ✅ Input Validation - Server-side validation for all inputs
- ✅ Environment Variables - Sensitive data in env vars, not code
- ✅ Error Handling - No sensitive data in error messages
- ✅ Session Security - Secure session configuration
- ✅ 2FA Support - Optional two-factor authentication
- ✅ Web3 Signature Verification - Secure wallet authentication
- Never commit
.envfiles - Use.env.exampleas template - Use strong JWT secrets - Minimum 32 characters, random
- Enable HTTPS in production - Use SSL/TLS certificates
- Regular dependency updates - Keep packages up to date
- Database security - Use strong MongoDB credentials
- API key protection - Rotate API keys regularly
- Rate limiting - Configure appropriate limits
- CORS configuration - Restrict to known origins
Use a process manager like PM2 or run each service in separate terminals:
# Using PM2 (recommended for production)
npm install -g pm2
pm2 start ecosystem.config.js
# Or manually in separate terminals
cd backend
npm run dev # Main server
npm run admin # Admin service
npm run manage # Management service
# ... etcBackend:
npm run dev # Start main server with nodemon
npm run admin # Start admin service
npm run manage # Start management service
npm run crash # Start crash game
# ... etcFrontend:
npm start # Start dev server (port 8800)
npm run build # Build for productionAdmin:
npm start # Start admin panel (port 9000)
npm run build # Build for production- Use the centralized logger instead of
console.log - Follow existing code style and conventions
- Write clear, commented code
- Use the error handler utilities
- Implement proper error handling
The platform uses a centralized logging system:
const logger = require('./utils/logger');
logger.info('Information message');
logger.warn('Warning message');
logger.error('Error message', { errorData });
logger.debug('Debug message');Logs are written to:
- Console (with colors)
- File:
./logs/app-YYYY-MM-DD.log
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild after changes
docker-compose up -d --build- Set
NODE_ENV=production - Use strong JWT secrets
- Configure MongoDB connection string
- Set up SSL/TLS certificates
- Configure CORS for production domains
- Set up monitoring and logging
- Configure backup strategy
- Set up rate limiting
- Enable HTTPS
- Configure firewall rules
- Set up health check monitoring
Development:
NODE_ENV=developmentDEV_MODE=trueNETWORK=testnet- Detailed error messages
Production:
NODE_ENV=productionDEV_MODE=falseNETWORK=mainnet- Generic error messages
- HTTPS enabled
- Proper CORS configuration
Port Already in Use:
# Find process using port
lsof -i :5000 # macOS/Linux
netstat -ano | findstr :5000 # Windows
# Kill process or change port in configMongoDB Connection Error:
- Verify MongoDB is running
- Check connection string in
.env - Verify network connectivity
- Check MongoDB credentials
Module Not Found:
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install --legacy-peer-depsSocket.IO Connection Issues:
- Verify Socket.IO server is running
- Check URL in frontend config
- Check CORS configuration
- Verify firewall rules
Docker Issues:
# Rebuild containers
docker-compose down
docker-compose build --no-cache
docker-compose up -dEnvironment Variables Not Loading:
- Verify
.envfile exists - Check file location (should be in service root)
- Restart the service after changes
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Follow existing code style
- Add comments for complex logic
- Update documentation if needed
- Test your changes
- Ensure all services start without errors
- Test the new functionality
- Commit your changes
git commit -m "Add amazing feature" - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- Use centralized logger instead of
console.log - Follow existing naming conventions
- Write clear commit messages
- Add error handling for new features
- Update documentation for significant changes
- Test thoroughly before submitting
This project is licensed under the ISC License.
You are free to use, modify, and distribute this software. However, please use it responsibly and in compliance with applicable laws and regulations in your jurisdiction.
For questions, support, or collaboration opportunities:
- Issues: Open an issue on GitHub
- Documentation: See API.md for API documentation
This platform utilizes various open-source libraries and frameworks. Special thanks to:
- React and the React community
- Express.js team
- MongoDB and Mongoose
- Socket.IO
- Material-UI
- All contributors and maintainers of the projects that make this platform possible
- Add more game types
- Implement WebSocket clustering for better scalability
- Add comprehensive test suite
- Implement CI/CD pipeline
- Add monitoring and alerting (Prometheus, Grafana)
- Implement caching layer (Redis)
- Add API versioning
- Implement GraphQL API option
- Add mobile app support
- Implement advanced analytics
Built with ❤️ for the crypto gaming community
⭐ Star this repo if you find it helpful!