6.3 KiB
6.3 KiB
๐ Run BetFun Arena - Complete Guide
โ WHAT'S READY
All code is complete! Here's how to run it:
๐ STEP 1: Install Dependencies
cd /Users/arhansubasi/betfun-arena/betfun-arena
# Install root dependencies
npm install
# Install frontend dependencies
cd apps/web
npm install
# Go back to root
cd ../..
๐ง STEP 2: Quick Environment Setup
Option A: Use Default Dev Settings (Fastest)
# Frontend
cat > apps/web/.env.local << 'EOF'
NEXT_PUBLIC_RPC_URL=https://api.devnet.solana.com
NEXT_PUBLIC_PROGRAM_ID=BetFunArenaPredictionMarketGameV1111111111111
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_WS_URL=http://localhost:3002
NEXT_PUBLIC_APP_URL=http://localhost:3000
EOF
# Backend (Optional - only if you want full functionality)
# For now, frontend works standalone with mock data
๐ฏ STEP 3: Run the App
Fastest Way: Frontend Only
cd apps/web
npm run dev
Then open: http://localhost:3000
Full Stack: All Services
Open 4 terminal windows:
Terminal 1 - Frontend:
cd apps/web
npm run dev
# Runs on http://localhost:3000
Terminal 2 - API (Optional):
cd packages/api
npm install
npm run dev
# Runs on http://localhost:3001
Terminal 3 - WebSocket (Optional):
cd packages/websocket
npm install
npm run dev
# Runs on http://localhost:3002
Terminal 4 - Indexer (Optional):
cd packages/indexer
npm install
npm run dev
# Runs in background
๐จ WHAT YOU'LL SEE
Once running, you'll have access to:
Pages (15 total)
- Home - Landing page with hero
- Feed - Browse all arenas
- Markets - Advanced market browser with filters
- Market Details - Individual market with charts
- Create - Create new prediction markets
- Arena - Arena details with live battles
- Trading - Advanced trading interface
- Activity - Your trading history
- Portfolio - Your positions and P&L
- Profile - User profile with achievements
- Leaderboard - Top traders rankings
- Notifications - Real-time alerts
- Settings - Account preferences
- Analytics - Platform metrics
- Tags - Browse by category
Features Available
- โ Browse markets
- โ View market details
- โ See price charts
- โ Check trading history
- โ View user profiles
- โ See leaderboards
- โ Check analytics
- โ All UI/UX features
Features Needing Backend
- โณ Actually place trades (needs smart contracts + API)
- โณ Real-time updates (needs WebSocket)
- โณ User authentication (needs Supabase)
- โณ Data persistence (needs database)
๐ณ ALTERNATIVE: Docker (Easiest)
If you have Docker installed:
# Create docker-compose.yml
cat > docker-compose.yml << 'EOF'
version: '3.8'
services:
frontend:
build:
context: ./apps/web
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_RPC_URL=https://api.devnet.solana.com
- NEXT_PUBLIC_PROGRAM_ID=BetFunArenaPredictionMarketGameV1111111111111
volumes:
- ./apps/web:/app
- /app/node_modules
redis:
image: redis:7-alpine
ports:
- "6379:6379"
EOF
# Run
docker-compose up
๐ฏ SIMPLIFIED STARTUP (RECOMMENDED)
For demo/development, just run the frontend:
# 1. Go to frontend
cd /Users/arhansubasi/betfun-arena/betfun-arena/apps/web
# 2. Install if needed
npm install
# 3. Create .env.local
echo 'NEXT_PUBLIC_RPC_URL=https://api.devnet.solana.com
NEXT_PUBLIC_PROGRAM_ID=BetFunArenaPredictionMarketGameV1111111111111
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_WS_URL=http://localhost:3002
NEXT_PUBLIC_APP_URL=http://localhost:3000' > .env.local
# 4. Run
npm run dev
# 5. Open browser
open http://localhost:3000
That's it! The frontend works standalone with:
- โ All 15 pages
- โ Complete UI/UX
- โ Navigation
- โ Mock data for demo
- โ Responsive design
๐ For Full Functionality
To enable trading, real-time updates, and persistence:
1. Setup Supabase (Free)
# Go to https://supabase.com
# Create new project
# Copy Project URL and API Key
# Add to .env files
2. Setup Redis (Local)
# macOS
brew install redis
redis-server
# Ubuntu
sudo apt install redis-server
sudo systemctl start redis
3. Deploy Smart Contracts
cd packages/anchor
anchor build
anchor deploy --provider.cluster devnet
# Note the Program ID
4. Update Environment Variables
# Update apps/web/.env.local with:
# - Real Program ID
# - Supabase URL
# - Redis URL
5. Start All Services
# Terminal 1
cd apps/web && npm run dev
# Terminal 2
cd packages/api && npm run dev
# Terminal 3
cd packages/websocket && npm run dev
# Terminal 4
cd packages/indexer && npm run dev
๐ Current Status
| Component | Status | What Works |
|---|---|---|
| Frontend | โ 100% | All pages, UI, navigation |
| Smart Contracts | โ 100% | Code complete, needs deployment |
| API Service | โ 100% | Code complete, needs backend setup |
| WebSocket | โ 100% | Code complete, needs backend setup |
| Indexer | โ 100% | Code complete, needs backend setup |
๐ฎ Quick Demo Mode
Want to see it NOW? Just run the frontend:
cd apps/web
npm run dev
You'll see:
- โ Beautiful UI
- โ All pages working
- โ Mock data populated
- โ Smooth animations
- โ Responsive design
- โ Complete user flows
โก Ultra Quick Start
cd /Users/arhansubasi/betfun-arena/betfun-arena/apps/web
npm install
npm run dev
open http://localhost:3000
Done! Browse all 15 pages and see the complete platform! ๐
๐ Troubleshooting
Port 3000 in use
lsof -i :3000
kill -9 <PID>
# Or change port: npm run dev -- -p 3001
Module not found
rm -rf node_modules package-lock.json
npm install
Build errors
npm run build
# Check for errors
# Fix TypeScript issues if any
๐ Support
Everything is ready to run! If you need help:
- Check logs in terminal
- See QUICKSTART.md for more details
- Read DEPLOYMENT_GUIDE.md for production
- Review README.md for full documentation
Status: โ
Ready to Run
Next: cd apps/web && npm run dev
Then: Open http://localhost:3000
๐ Enjoy BetFun Arena! โ๏ธ๐