Skip to Content
BetSwirl Affliate program is released ๐ŸŽ‰
Developer Hubโ–ถ๏ธ DemosUI React๐Ÿš€ React dApp

React Integration Guide

This guide walks you through creating a casino application using BetSwirlโ€™s React UI library.

What youโ€™ll build: A fully functional multi-game with multi-chain support, custom theming, and background image - exactly like our live demoย .

Time: ~10 minutes

Prerequisites

  • Node.js v18+
  • Git
  • GitHub account
  • Vercel account

Build Your Casino App

Step 1: Fork Repository

Fork this repository: https://github.com/BetSwirl/ui-react-demoย 

Click the โ€œForkโ€ button in the top right corner to create your own copy.

Step 2: Clone and Run

# Clone your forked repository git clone https://github.com/YOUR_USERNAME/ui-react-demo.git cd ui-react-demo # Install dependencies npm install # Create .env file from template cp .env.example .env

You can fill .env now or leave it empty - how to configure affiliate address and custom RPC is explained below in Add your affiliate address & custom RPCs section.

# Start dev server (your .env file must be empty or configured to make it working) npm run dev

Open in browser http://localhost:5173

What You Have Now

Your React casino application is ready with the following features already configured:

  • BetSwirl SDK integration with support for Base, Polygon, Arbitrum, BSC and Avalanche
  • OnchainKit wallet connection
  • Multiple games with navigation (Dice, Coin Toss, Roulette)
  • Custom theming and branding with gold accents and dark theme
  • Background images for page and game
  • Freebet system for user promotions
  • Leaderboard support for competitive tournaments
  • Token selection with filtering for ETH, BETS, DEGEN and USDC

Next steps: Deploy to Vercel and add your affiliate address to start earning 30% commission from all bets.

Deploy to Vercel

Now deploy your casino to the web and get a public URL.

1. Sign up on Vercel: Go to vercel.comย  โ†’ โ€œSign Upโ€ โ†’ โ€œContinue with GitHubโ€ โ†’ Authorize access

2. Create new project: Click โ€œAdd Newโ€ฆโ€ โ†’ โ€œProjectโ€ โ†’ Find my-casino-app โ†’ โ€œImportโ€

3. Configure and deploy: Vercel auto-detects Vite settings. Leave defaults and click โ€œDeployโ€

4. Wait for build to complete (1-2 minutes), then copy your production URL: https://my-casino-app.vercel.app

5. Test your live casino: Open the URL, connect wallet, and place a bet.

Whatโ€™s next: Every git push automatically deploys. GitHub now shows a โ€œDeploymentsโ€ tab with deployment history and status checks.

Add your affiliate address & custom RPCs

As an affiliate, you earn 30% of house edge revenue from every bet placed through your casino. Add your wallet address to start earning, and configure custom RPC endpoints for better performance.

Learn more: Affiliate Program - track earnings, create freebets, manage leaderboards, and claim revenue.

1. Add environment variables to Vercel:

  • Go to your project on vercel.comย 
  • Click โ€œSettingsโ€ โ†’ โ€œEnvironment Variablesโ€
  • Add your affiliate address (required):
NameValue
VITE_AFFILIATE_ADDRESSYour wallet address (to earn 30% commission)
  • Optional: Add custom RPC endpoints for better performance and reliability. Without these, the app uses free public RPCs which may be slower or rate-limited:
NameValue
VITE_BASE_RPC_URLYour Base RPC URL
VITE_POLYGON_RPC_URLYour Polygon RPC URL
VITE_ARBITRUM_RPC_URLYour Arbitrum RPC URL
VITE_BSC_RPC_URLYour BSC RPC URL
VITE_AVALANCHE_RPC_URLYour Avalanche RPC URL

RPC providers: Alchemyย , Infuraย , QuickNodeย  (most offer free tiers)

  • Optional: Enable test mode (for testing on testnet chains):
NameValue
VITE_TEST_MODEtrue or false

Click โ€œSaveโ€ after adding variables.

2. Deploy changes:

Once you saved the new environment variables, Vercel will automatically ask you to redeploy the project.

3. Check your earnings:

Once deployed, track your affiliate revenue:

  1. Go to Revenues Dashboardย 
  2. Connect the same wallet you used for VITE_AFFILIATE_ADDRESS
  3. View your earnings in real-time (30% of house edge from each bet)
  4. Click โ€œClaimโ€ to withdraw your earnings

Optional Enhancements

The base setup above gives you a fully functional casino. Below are optional features you can add to enhance your application.

โ€”

Example Result

Last updated on