the account dashboard requires multiple REST API calls to fetch different pieces of data:
POST /balance- Gets user balance, bonus, points, KYC status, network infoGET /transactions?limit=5- Gets recent transactionsGET /jackpots/active- Gets active jackpots user is participating inGET /freebets- Gets available freebets
Issues with REST approach:
- ❌ Over-fetching:
/balanceendpoint returns ALL user data even if you only need balance - ❌ Multiple round trips: 4+ separate HTTP requests = slower loading
- ❌ Under-fetching: Need to make multiple calls to get related data
- ❌ Mobile inefficiency: More requests = more battery drain, slower on 3G/4G
With GraphQL, you can fetch exactly what you need in a single query:
query GetAccountDashboard {
account(userId: "user_123") {
balance
bonus
points
recentTransactions(limit: 5) {
type
amount
status
}
activeJackpots {
name
prize
ticketsCount
}
freebets {
amount
expiresAt
}
}
}Benefits:
- ✅ Single request: One HTTP call gets all related data
- ✅ Fetch only needed fields: Request only
balanceandbonusif that's all you need - ✅ Nested relationships: Get user + transactions + jackpots in one query
- ✅ Mobile-friendly: Less bandwidth, faster loading, better battery life