Skip to content

Talibabtou/versusrip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

192 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Versus.rip - Modern Betting Platform on Solana

TypeScript Next.js React Solana Fastify License

Versus.rip is a modern, real-time betting platform built on Solana blockchain. Watch AI fighters battle in epic matches while placing bets with cryptocurrency. Experience the thrill of live betting with instant payouts, real-time odds, and a mobile-first design.

๐ŸŽฏ What is Versus?

Versus transforms AI fighting matches into an exciting betting experience:

  • Watch live AI battles streamed directly in the platform
  • Bet on red vs blue corners with real SOL cryptocurrency
  • Real-time odds updates based on community betting volumes
  • Instant blockchain payouts when your fighter wins
  • Mobile-optimized for betting on the go
  • Achievement system with unlockable rewards
  • Referral bonuses for bringing friends

๐Ÿš€ Current Status

โœ… Fully implemented and ready for production!

All services are deployed and working in production:

  • Frontend: Modern React 19 + Next.js 15 interface
  • Backend: High-performance Fastify API with real-time updates
  • Oracle: Solana blockchain integration for secure betting
  • Scraper: Twitch chat monitoring for live match detection

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend      โ”‚โ—„โ”€โ”€โ–บโ”‚   Backend API   โ”‚โ—„โ”€โ”€โ–บโ”‚   PostgreSQL    โ”‚
โ”‚  Next.js 15     โ”‚    โ”‚  Fastify + SSE  โ”‚    โ”‚   Database      โ”‚
โ”‚  React 19       โ”‚    โ”‚   TypeScript    โ”‚    โ”‚   (Railway)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ”‚                       โ”‚                       โ”‚
         โ–ผ                       โ–ผ                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Solana Wallets  โ”‚    โ”‚     Oracle      โ”‚    โ”‚    Scraper      โ”‚
โ”‚ Phantom/Solflareโ”‚    โ”‚  Blockchain     โ”‚    โ”‚  Twitch Chat    โ”‚
โ”‚   Integration   โ”‚    โ”‚   Integration   โ”‚    โ”‚   Monitoring    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Key Features

๐ŸŽฎ Real-Time Betting Experience

  • Live betting interface with red vs blue corner selection
  • Dynamic odds that update based on betting volumes
  • Real-time updates via Server-Sent Events (no page refresh needed)
  • Mobile-first design optimized for phones and tablets

๐Ÿ” Secure Blockchain Integration

  • Solana wallet support - Phantom, Solflare, and more
  • Smart contract security - Oracle-controlled betting gates
  • Instant payouts - Automatic SOL transfers to winners
  • Transparent betting - All transactions on-chain

๐Ÿ“ฑ Modern User Experience

  • Responsive design - Works perfectly on all devices
  • Real-time notifications - Live updates on match status
  • Achievement system - Unlock rewards for betting milestones
  • Referral program - Earn bonuses for inviting friends

โšก High Performance

  • Sub-second updates - Real-time game state changes
  • Smart rate limiting - Prevents abuse while maintaining speed
  • Optimized loading - Fast page loads and smooth interactions
  • Production-ready - Deployed and battle-tested

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ for development
  • Solana wallet (Phantom recommended)
  • PostgreSQL database (Railway recommended)

Development Setup

# Clone and install
git clone <repository-url>
cd versus
make install

# Configure environment
cp .env.example .env
# Edit .env with your settings

# Start all services
make run

Environment Configuration

# Backend API
PORT=3001
DATABASE_URL=postgresql://your-database-url
CORS_ORIGIN=http://localhost:3000

# Oracle Service
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
DEPOSIT_GATE_PROGRAM_ID=your-program-id
ORACLE_API_KEY=your-oracle-key

# Scraper Service
BACKEND_API_URL=http://localhost:3001/api
SCRAPER_API_KEY=your-scraper-key
TWITCH_CHANNEL=saltybet

# Frontend
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com

๐Ÿ› ๏ธ Technology Stack

Frontend

  • Next.js 15 - React framework with App Router
  • React 19 - Latest React with modern hooks
  • TypeScript 5.9 - Full type safety
  • Tailwind CSS v4 - Modern utility-first styling
  • Redux Toolkit - Predictable state management
  • Solana Wallet Adapter - Seamless wallet integration

Backend

  • Fastify 5.5 - High-performance Node.js framework
  • Server-Sent Events - Real-time updates to all clients
  • Drizzle ORM - Type-safe database operations
  • PostgreSQL - Reliable, scalable database
  • TypeScript - End-to-end type safety

Blockchain

  • Solana Web3.js - Blockchain integration
  • Smart Contracts - Secure betting gate management
  • Oracle Service - Automated payout processing
  • Wallet Integration - Support for all major Solana wallets

Services

  • Scraper Service - Twitch chat monitoring for match detection
  • Oracle Service - Blockchain transaction processing
  • Real-time Communication - WebSocket and SSE for live updates

๐Ÿ“ Project Structure

versus/
โ”œโ”€โ”€ frontend/           # Next.js 15 + React 19 app
โ”‚   โ”œโ”€โ”€ src/components/ # React components (game, layout, ui)
โ”‚   โ”œโ”€โ”€ src/redux/      # State management (9 slices)
โ”‚   โ”œโ”€โ”€ src/hooks/      # Custom React hooks (12 hooks)
โ”‚   โ””โ”€โ”€ README.md       # Frontend documentation
โ”‚
โ”œโ”€โ”€ backend/            # Fastify API + SSE hub
โ”‚   โ”œโ”€โ”€ src/routes/     # API endpoints (9 routes)
โ”‚   โ”œโ”€โ”€ src/db/         # Database schema and operations
โ”‚   โ”œโ”€โ”€ src/services/   # Business logic services
โ”‚   โ””โ”€โ”€ README.md       # Backend documentation
โ”‚
โ”œโ”€โ”€ oracle/             # Blockchain integration service
โ”‚   โ”œโ”€โ”€ src/oracle/     # Core betting operations
โ”‚   โ”œโ”€โ”€ src/solana/     # Blockchain interactions
โ”‚   โ”œโ”€โ”€ src/api/        # Backend communication
โ”‚   โ””โ”€โ”€ README.md       # Oracle documentation
โ”‚
โ”œโ”€โ”€ scraper/            # Twitch chat monitoring
โ”‚   โ”œโ”€โ”€ src/            # Chat parsing and API integration
โ”‚   โ””โ”€โ”€ README.md       # Scraper documentation
โ”‚
โ”œโ”€โ”€ Makefile            # Development commands
โ””โ”€โ”€ README.md           # This overview

๐ŸŽฎ How It Works

1. Match Detection

The Scraper monitors Twitch chat for SaltyBet match announcements and extracts fighter information.

2. Betting Opens

The Oracle opens the betting gate on Solana, allowing users to place bets with their wallets.

3. Real-Time Updates

The Backend broadcasts live updates via Server-Sent Events, showing betting volumes and odds changes.

4. Match Resolution

When a match ends, the Oracle automatically processes payouts and sends SOL to winners.

5. Frontend Updates

The Frontend receives real-time updates and immediately reflects changes in the user interface.

๐Ÿ”’ Security & Performance

Security Features

  • Smart contract validation - Oracle-controlled betting gates
  • Rate limiting - 300 requests per minute per IP
  • CORS protection - Configurable origin validation
  • Input validation - TypeScript type safety throughout
  • Service authentication - Secure inter-service communication

Performance Optimizations

  • Real-time updates - Sub-second SSE broadcasts
  • Optimized queries - Efficient database operations
  • Smart caching - Reduced API calls and faster responses
  • Mobile optimization - Touch-friendly, fast-loading interface

๐Ÿš€ Deployment

All services are production-ready and can be deployed to:

Recommended Platforms

  • Frontend: Vercel or Railway
  • Backend: Railway or VPS
  • Database: Railway PostgreSQL
  • Services: Railway or VPS with PM2

Production Features

  • Health monitoring - Built-in health check endpoints
  • Error recovery - Automatic reconnection and retry logic
  • Graceful shutdown - Clean service termination
  • Logging - Comprehensive error and performance logging

๐Ÿ“Š Current Implementation Status

Service Status Technology Notes
Frontend โœ… Complete Next.js 15 + React 19 Ready for production, needs final polish
Backend โœ… Complete Fastify + SSE + PostgreSQL Fully deployed and working
Oracle โœ… Complete TypeScript + Solana Web3.js Handling real blockchain transactions
Scraper โœ… Complete TypeScript + WebSocket Monitoring Twitch 24/7

๐ŸŽฏ What Makes Versus Special

For Users

  • Real cryptocurrency betting with instant blockchain payouts
  • Mobile-optimized experience for betting anywhere
  • Live match streaming with integrated betting interface
  • Achievement system with unlockable rewards and bonuses

For Developers

  • Modern tech stack with TypeScript everywhere
  • Real-time architecture with SSE and WebSocket
  • Clean separation of concerns across services
  • Production-ready with comprehensive error handling

For the Future

  • Scalable architecture ready for millions of users
  • Extensible design for new game types and features
  • Blockchain-native built for the decentralized future
  • Community-driven with referral systems and social features

๐Ÿ”ฎ Next Steps

The platform is fully functional and ready for users. Future enhancements include:

  • Tournament system - Multi-match tournaments with brackets
  • Advanced analytics - Detailed betting statistics and insights
  • Social features - User profiles and community interactions
  • Mobile app - Native iOS and Android applications
  • Multi-chain support - Expand beyond Solana to other blockchains

๐Ÿค Contributing

We welcome contributions! Check out our individual service READMEs for specific development guides:

๐Ÿ“„ License

MIT License - see LICENSE for details.

About

Versus Fighting Betting Platform on Solana

Topics

Resources

Stars

Watchers

Forks

Contributors