Backend Service Overview
BattlesBit is a competitive trading game platform where players use real money to enter trading challenges and compete against each other using virtual balance to maximize profits. The winner takes the prize pool.
Core Concept
Real Money (Entry Fee) -> Virtual Trading Balance -> Compete -> Winner Takes PrizeHow It Works
- Entry: Players pay a real entry fee from their wallet to join a game/challenge
- Virtual Balance: Each player receives a virtual trading balance (e.g., $100 USDT)
- Trading: Players open positions using real-time market data (Binance)
- Competition: Players compete to achieve the highest profit during the match duration
- Settlement: Winner receives the prize pool + rewards + XP
Tech Stack
| Component | Technology |
|---|---|
| Language | Go |
| Database | PostgreSQL (via Ent ORM) |
| API | GraphQL (gqlgen) |
| Messaging | NATS JetStream |
| Workflows | Temporal |
| Market Data | Binance WebSocket |
| Blockchain | Solana (HD Wallet) |
| Notifications | Firebase + Email |
Key Modules
Trading Module
- Position management (open, close, cancel)
- Real-time PnL calculation
- Liquidation engine
- Market/Limit orders
- Stop Loss & Take Profit
Challenge Module
- Game definitions with rules
- Matchmaking system
- Match lifecycle management
- Ranking calculation
- Reward distribution
Wallet Module
- Solana HD wallet integration
- Deposit/Withdraw
- Transaction history
- Balance management
Achievement System
- Rule-based achievements
- Progress tracking
- Temporal workflows
Notification System
- In-app real-time (NATS)
- Push notifications (Firebase)
- Email (OTP)
Services Architecture
cmd/
├── web # GraphQL API server
├── arena # Position calculation worker
├── market # Market data streaming
├── matcher # Matchmaking service
├── achievement # Achievement processor
└── notifications # Notification workerCurrent Progress
Overall: ~55% Complete (adjusted for V1 scope)
See Feature Tracking for detailed status.
Last updated on