5.2 KiB
5.2 KiB
๐ Vercel Deployment Guide - BetFun Arena
Prerequisites
- Vercel Account: Sign up at vercel.com
- GitHub Repository: Ensure your code is pushed to GitHub
- Environment Variables: Prepare all required environment variables
Quick Deploy
Option 1: Deploy via Vercel CLI (Recommended)
# Install Vercel CLI globally
npm i -g vercel
# Login to Vercel
vercel login
# Navigate to project root
cd /Users/arhansubasi/betfun-arena/betfun-arena
# Deploy (follow prompts)
vercel
# For production deployment
vercel --prod
Option 2: Deploy via Vercel Dashboard
- Go to vercel.com/new
- Import your GitHub repository
- Configure project settings:
- Framework Preset: Next.js
- Root Directory:
apps/web - Build Command:
pnpm install && pnpm run build - Output Directory:
.next - Install Command:
pnpm install
Environment Variables
Set these in Vercel Dashboard โ Project Settings โ Environment Variables:
Required Variables
# Solana Configuration
NEXT_PUBLIC_SOLANA_RPC_URL=https://api.devnet.solana.com
# Or for mainnet: https://api.mainnet-beta.solana.com
# Or use a custom RPC: https://your-rpc-endpoint.com
NEXT_PUBLIC_PROGRAM_ID=HrS1KpYRWfg9xUom8jnGqoRAayVCxHxukeb18C4WKAkE
# Your deployed Solana program ID
NEXT_PUBLIC_NETWORK=devnet
# Options: devnet, mainnet
# Supabase (Optional - for database features)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Indie.fun API (Optional - for sponsor integration)
NEXT_PUBLIC_INDIE_FUN_API_URL=https://api.indie.fun
# Moddio (Optional - for 3D world integration)
NEXT_PUBLIC_MODDIO_WORLD_ID=your_moddio_world_id
# Sentry (Optional - for error tracking)
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn
SENTRY_ORG=your_sentry_org
SENTRY_PROJECT=your_sentry_project
Setting Environment Variables via CLI
# Set environment variables
vercel env add NEXT_PUBLIC_SOLANA_RPC_URL
vercel env add NEXT_PUBLIC_PROGRAM_ID
vercel env add NEXT_PUBLIC_NETWORK
# Add for all environments (production, preview, development)
vercel env add NEXT_PUBLIC_SOLANA_RPC_URL production
Project Configuration
The vercel.json file is already configured with:
- โ Correct build command for monorepo
- โ
Root directory set to
apps/web - โ Security headers
- โ Environment variable references
Build Settings
Vercel will automatically detect Next.js, but ensure:
- Node.js Version: 18.x or higher (set in Vercel dashboard)
- Package Manager: pnpm (configured in
vercel.json) - Build Command:
pnpm install && pnpm run build(inapps/webdirectory)
Deployment Steps
-
Push to GitHub (if not already done):
git add . git commit -m "Ready for Vercel deployment" git push origin main -
Deploy via Vercel Dashboard:
- Go to vercel.com/new
- Import your repository
- Configure environment variables
- Click "Deploy"
-
Or Deploy via CLI:
vercel --prod
Post-Deployment
-
Verify Deployment:
- Check the deployment URL provided by Vercel
- Test wallet connection
- Verify mock arenas are displayed
-
Custom Domain (Optional):
- Go to Project Settings โ Domains
- Add your custom domain
- Configure DNS records as instructed
-
Monitor:
- Check Vercel dashboard for build logs
- Monitor function logs for errors
- Set up Sentry for error tracking (if configured)
Troubleshooting
Build Fails
-
Check Build Logs:
- Go to Vercel Dashboard โ Deployments โ Click on failed deployment
- Review build logs for errors
-
Common Issues:
- Missing dependencies: Ensure
pnpm installruns successfully - Type errors: Run
pnpm run check-typeslocally first - Environment variables: Verify all required vars are set
- Missing dependencies: Ensure
Runtime Errors
-
Check Function Logs:
- Vercel Dashboard โ Functions tab
- Look for runtime errors
-
Common Issues:
- Missing env vars: Verify all
NEXT_PUBLIC_*vars are set - RPC errors: Check Solana RPC endpoint is accessible
- CORS issues: Verify headers in
vercel.json
- Missing env vars: Verify all
Mock Data Not Showing
- Verify
NEXT_PUBLIC_PROGRAM_IDis set correctly - Check browser console for errors
- Ensure Solana RPC endpoint is accessible
Environment-Specific Deployments
Development
vercel
Preview (for PRs)
- Automatically deployed on pull requests
- Uses preview environment variables
Production
vercel --prod
Continuous Deployment
Vercel automatically deploys:
- โ
Every push to
mainbranch โ Production - โ Every pull request โ Preview deployment
- โ Every push to other branches โ Preview deployment
Additional Resources
Support
If you encounter issues:
- Check Vercel build logs
- Review browser console errors
- Verify environment variables are set correctly
- Check that the Solana program is deployed and accessible