341 lines
6.3 KiB
Markdown
341 lines
6.3 KiB
Markdown
# ๐ Run BetFun Arena - Complete Guide
|
|
|
|
## โ
WHAT'S READY
|
|
|
|
All code is complete! Here's how to run it:
|
|
|
|
---
|
|
|
|
## ๐ STEP 1: Install Dependencies
|
|
|
|
```bash
|
|
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)
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
cd apps/web
|
|
npm run dev
|
|
```
|
|
|
|
Then open: **http://localhost:3000**
|
|
|
|
### Full Stack: All Services
|
|
|
|
Open **4 terminal windows**:
|
|
|
|
**Terminal 1 - Frontend:**
|
|
```bash
|
|
cd apps/web
|
|
npm run dev
|
|
# Runs on http://localhost:3000
|
|
```
|
|
|
|
**Terminal 2 - API (Optional):**
|
|
```bash
|
|
cd packages/api
|
|
npm install
|
|
npm run dev
|
|
# Runs on http://localhost:3001
|
|
```
|
|
|
|
**Terminal 3 - WebSocket (Optional):**
|
|
```bash
|
|
cd packages/websocket
|
|
npm install
|
|
npm run dev
|
|
# Runs on http://localhost:3002
|
|
```
|
|
|
|
**Terminal 4 - Indexer (Optional):**
|
|
```bash
|
|
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)
|
|
1. **Home** - Landing page with hero
|
|
2. **Feed** - Browse all arenas
|
|
3. **Markets** - Advanced market browser with filters
|
|
4. **Market Details** - Individual market with charts
|
|
5. **Create** - Create new prediction markets
|
|
6. **Arena** - Arena details with live battles
|
|
7. **Trading** - Advanced trading interface
|
|
8. **Activity** - Your trading history
|
|
9. **Portfolio** - Your positions and P&L
|
|
10. **Profile** - User profile with achievements
|
|
11. **Leaderboard** - Top traders rankings
|
|
12. **Notifications** - Real-time alerts
|
|
13. **Settings** - Account preferences
|
|
14. **Analytics** - Platform metrics
|
|
15. **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:
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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)
|
|
```bash
|
|
# Go to https://supabase.com
|
|
# Create new project
|
|
# Copy Project URL and API Key
|
|
# Add to .env files
|
|
```
|
|
|
|
### 2. Setup Redis (Local)
|
|
```bash
|
|
# macOS
|
|
brew install redis
|
|
redis-server
|
|
|
|
# Ubuntu
|
|
sudo apt install redis-server
|
|
sudo systemctl start redis
|
|
```
|
|
|
|
### 3. Deploy Smart Contracts
|
|
```bash
|
|
cd packages/anchor
|
|
anchor build
|
|
anchor deploy --provider.cluster devnet
|
|
# Note the Program ID
|
|
```
|
|
|
|
### 4. Update Environment Variables
|
|
```bash
|
|
# Update apps/web/.env.local with:
|
|
# - Real Program ID
|
|
# - Supabase URL
|
|
# - Redis URL
|
|
```
|
|
|
|
### 5. Start All Services
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
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
|
|
|
|
```bash
|
|
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
|
|
```bash
|
|
lsof -i :3000
|
|
kill -9 <PID>
|
|
# Or change port: npm run dev -- -p 3001
|
|
```
|
|
|
|
### Module not found
|
|
```bash
|
|
rm -rf node_modules package-lock.json
|
|
npm install
|
|
```
|
|
|
|
### Build errors
|
|
```bash
|
|
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! โ๏ธ๐
|
|
|