Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Problem Statement

the account dashboard requires multiple REST API calls to fetch different pieces of data:

  1. POST /balance - Gets user balance, bonus, points, KYC status, network info
  2. GET /transactions?limit=5 - Gets recent transactions
  3. GET /jackpots/active - Gets active jackpots user is participating in
  4. GET /freebets - Gets available freebets

Issues with REST approach:

  • Over-fetching: /balance endpoint 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

GraphQL Solution

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 balance and bonus if that's all you need
  • Nested relationships: Get user + transactions + jackpots in one query
  • Mobile-friendly: Less bandwidth, faster loading, better battery life

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages