Real World Example

A Backend for a Mobile Home Screen

Apps with rich home screens (Netflix, Airbnb, Myntra) use GraphQL so each screen fetches everything in one round trip, which matters on slow mobile networks. The ShopEase app home screen in one query:

query Home($userId: ID!) {
  me { name walletBalance }
  banners(placement: HOME) { imageUrl link }
  recommended(limit: 6) { id name price imageUrl }
  recentOrders(limit: 2) { id status total }
}

Example

curl -s http://localhost:3000/graphql -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d @home-query.json

Example output

{"data":{"me":{"name":"Asha","walletBalance":250},"banners":[{"imageUrl":"https://cdn.shopease.in/b/sale.webp","link":"/sale"}],"recommended":[{"id":"7","name":"boAt Airdopes 141","price":1299,"imageUrl":"https://cdn.shopease.in/p/7.webp"}],"recentOrders":[{"id":"ORD-7781","status":"DELIVERED","total":2598}]}}

Tip: Protect GraphQL APIs with query depth and complexity limits; one malicious nested query can otherwise ask for millions of objects.