A modern, real-time crash-style gambling game built on Solana with provably fair gaming mechanics. Time your exit before the multiplier crashes!
- Live Crash Game: Watch the multiplier rise and cash out before it crashes
- Solana Wallet Integration: Connect with Phantom and Solflare wallets
- Provably Fair System: Transparent and verifiable crash points
- Auto Cashout: Set automatic cashout at your preferred multiplier
- Sidebet System: Bet on crashes within 10 seconds for 5x payout
- Real-time Chart: Live multiplier visualization with historical data
- Player Tracking: See active players and recent winners
- Real-time Updates: WebSocket-powered live updates
- Responsive Design: Modern UI that works on all devices
- Secure Authentication: JWT-based user authentication
- Rate Limiting: Protection against abuse
- Database Persistence: PostgreSQL with Prisma ORM
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Framer Motion - Smooth animations
- Socket.IO Client - Real-time communication
- Node.js - JavaScript runtime
- Express.js - Web framework
- Socket.IO - Real-time bidirectional communication
- Prisma - Database ORM
- PostgreSQL - Primary database
- JWT - Authentication tokens
- Solana Web3.js - Solana blockchain integration
- Wallet Adapter - Multi-wallet support
- Devnet/Mainnet - Network flexibility
- Node.js 18+
- Docker & Docker Compose
- Solana CLI (optional)
- Git
git clone <repository-url>
cd rugsfenpm installcp env.example .env.localThe .env.local file is pre-configured with:
- Docker database credentials
- Your Helius API key for enhanced Solana RPC
- Mainnet configuration
- Redis cache settings
# Generate Prisma client
npx prisma generate
# Start Docker services (PostgreSQL + Redis)
docker-compose up -d
# Run database migrations
npx prisma db push# Terminal 1: Start the backend API
npm run dev:server
# Terminal 2: Start the frontend
npm run devVisit http://localhost:3000 to see the application.
# Run the automated setup script
chmod +x setup.sh
./setup.sh- Click "Connect Wallet" on the homepage
- Choose your preferred Solana wallet (Phantom, Solflare)
- Approve the connection
- Set your bet amount in SOL
- Choose your auto cashout multiplier (optional)
- Click "BUY" to enter the round
- Watch the multiplier rise in real-time
- The longer you wait, the higher the potential payout
- Click "CASHOUT" before the chart crashes
- If you wait too long and it crashes, you lose your bet
- Start with small bets to learn the game
- Use auto cashout for consistent profits
- Don't get greedy - cash out early for safer gains
- Watch the recent results to understand patterns
Our platform uses a provably fair system to ensure crash point integrity:
- Crash Point Generation: Before each round, the server generates a provably fair crash point
- Hash Publication: The server publishes a hash of the crash point before the round starts
- Multiplier Calculation: The multiplier rises continuously until it reaches the crash point
- Crash Point Revelation: After the round ends, the original crash point is revealed
- Verification: Players can verify fairness by checking the hash and running the algorithm
The crash point is generated using the formula: crashPoint = max(1.0, 0.99 / (1 - random))
This ensures a fair distribution where most crashes happen early, but high multipliers are possible.
You can verify any crash point by:
- Confirming the hash of the revealed crash point matches the pre-published hash
- Running the verification algorithm with the seed to produce the same crash point
rugsfe/
โโโ app/ # Next.js app directory
โ โโโ components/ # React components
โ โโโ hooks/ # Custom React hooks
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Home page
โ โโโ providers.tsx # Context providers
โโโ api/ # Backend API
โ โโโ server.ts # Express server with Socket.IO
โโโ prisma/ # Database schema and migrations
โ โโโ schema.prisma # Prisma schema
โโโ public/ # Static assets
โโโ package.json # Dependencies and scripts
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string (Docker) | postgresql://rugs_user:rugs_password@localhost:5432/rugs_fun_db |
JWT_SECRET |
Secret key for JWT tokens | Required |
FRONTEND_URL |
Frontend application URL | http://localhost:3000 |
PORT |
Backend server port | 3001 |
SOLANA_NETWORK |
Solana network | mainnet-beta |
HELIUS_API_KEY |
Helius API key for enhanced RPC | Pre-configured |
SOLANA_RPC_ENDPOINT |
Helius RPC endpoint | Pre-configured |
REDIS_URL |
Redis cache URL | redis://localhost:6379 |
The application uses the following main entities:
- Users: Player accounts and statistics
- Battles: Game sessions and configurations
- BattleParticipants: Player participation in battles
- Transactions: Financial transactions and history
- ChatMessages: Real-time chat messages
- Badges: Achievement badges
- Achievements: Player accomplishments
npm run build
# Deploy to Vercel or your preferred platform# Set up environment variables
# Deploy the api/ directory- Use a managed PostgreSQL service (Railway, Supabase, etc.)
- Run migrations:
npx prisma db push
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
This is a demonstration project. Use at your own risk. Never bet more than you can afford to lose.
For support, please open an issue on GitHub or contact the development team.
Built with โค๏ธ for the Solana community