When developing a mobile application, you often face a dilemma: REST API either returns too much data (overfetching) or requires multiple requests (underfetching). GraphQL solves this but adds complexity. We develop a typed GraphQL API that perfectly fits the mobile client data model. Our experience — over 5 years and 50+ implemented projects — guarantees stable operation even under high load. Comparison with REST: on complex screens, GraphQL reduces traffic by 2–3 times, and with Persisted Queries — by an additional 10–20%. This provides real savings — up to 5,000 rubles per month for an app with 10,000 active users.
"GraphQL is a query language for APIs that allows clients to request only the data they need." — Wikipedia
Scenarios for Justified Use of GraphQL
GraphQL adds complexity: a server implementation (resolvers, schema, DataLoader), a client library, and team training. Justified scenarios:
- Different clients (iOS, Android, Web) need to be served from one API, and their data requirements differ significantly.
- Rapidly changing UI — you can add fields to a query without changing the server.
- Nested data with variable depth (social graph, catalog with categories).
For CRUD with predictable data structure, REST is simpler. GraphQL is not a silver bullet. We help choose the right tool and design the schema to avoid typical mistakes.
Type Safety with Apollo Client
Apollo Client generates type-safe query classes from .graphql files. This reduces the number of bugs by 30–40% compared to manual JSON handling.
Android (Apollo Kotlin)
# app/src/main/graphql/GetProduct.graphql query GetProduct($id: ID!) { product(id: $id) { id name price thumbnail { url width height } } } // auto-generated type GetProductQuery.Data val response = apolloClient.query(GetProductQuery(id = productId)).execute() val product = response.data?.product apolloClient is configured once with HttpEngine, authorization headers, and cache:
val apolloClient = ApolloClient.Builder() .serverUrl("https://api.example.com/graphql") .addHttpHeader("Authorization", "Bearer $token") .normalizedCache(MemoryCacheFactory(maxSizeBytes = 10 * 1024 * 1024)) .build() normalizedCache — normalized cache by id field. Querying a product from the feed and from the detail page returns the same object in memory — an update in one place automatically reflects everywhere.
iOS (Apollo iOS)
let client = ApolloClient( networkTransport: RequestChainNetworkTransport( interceptorProvider: DefaultInterceptorProvider(store: store), endpointURL: URL(string: "https://api.example.com/graphql")! ), store: store ) client.fetch(query: GetProductQuery(id: productId)) { result in switch result { case .success(let response): let product = response.data?.product case .failure(let error): print(error) } } Subscriptions for Real-Time
GraphQL subscriptions — WebSocket channel for real-time updates: chats, live prices, order statuses. Example schema:
subscription OnOrderStatusChanged($orderId: ID!) { orderStatusChanged(orderId: $orderId) { status updatedAt } } On Android, subscriptions are connected via WebSocketNetworkTransport as Flow/Coroutine.
How Apollo Client Accelerates Development?
Code generation from .graphql files eliminates manual DTO writing and mapping. Changing the schema immediately updates all clients — mismatches are caught at compile time. This speeds up iterations: changing a field on the server doesn't require synchronization with the mobile team. In a project with 20+ screens, time savings on coordination reach 30%, resulting in budget savings of up to 200,000 rubles.
Why DataLoader is Mandatory for GraphQL?
Without DataLoader, a query for 100 products would issue 100 separate SQL queries for categories. DataLoader batches them into a single SELECT ... WHERE id IN (...). This is a mandatory pattern when designing the server side. We implement it from the start, avoiding performance degradation under load.
Optimization: Persisted Queries
Automatic Persisted Queries (APQ): the client sends the SHA256 hash of the query. The server returns data if it knows the hash; otherwise, it requests the full text. Apollo Client supports APQ out of the box. This saves traffic and speeds up requests.
Error Handling
GraphQL returns HTTP 200 even on errors. Errors are in the response body: {"data": { "product": null }, "errors": [{ "message": "Product not found" }]}. The client must check the errors array regardless of the HTTP status. Apollo Client provides the list of errors in response.errors.
Comparison: GraphQL vs REST for Mobile
| Criteria | REST | GraphQL |
|---|---|---|
| Query flexibility | Fixed endpoints | Client selects fields |
| Overfetching | Often | No |
| Underfetching | Often | No |
| Client caching | HTTP cache | Normalized cache |
| Versioning | Via URL | Schema evolution |
| Performance on mobile | Depends on case | Higher on complex screens |
GraphQL API Development Stages
| Stage | Duration |
|---|---|
| Screen and requirements analysis | 2–3 days |
| Schema design | 3–5 days |
| Resolver implementation with DataLoader | 5–7 days |
| Apollo Client integration on both platforms | 3–5 days |
| Testing and optimization | 2–3 days |
| Documentation and deployment | 1–2 days |
How to Set Up Apollo Client on Android: Step-by-Step
- Install the Apollo Kotlin library via Gradle.
- Create an
ApolloClientinstance with the server URL and cache. - Define
.graphqlqueries in thegraphqlfolder. - Execute the query via
apolloClient.query()and handle the result.
Order GraphQL API development — get an estimate in 1 business day.
Example of Setting Up Apollo Client on iOS
let store = ApolloStore() let client = ApolloClient( networkTransport: RequestChainNetworkTransport( interceptorProvider: DefaultInterceptorProvider(store: store), endpointURL: URL(string: "https://api.example.com/graphql")! ), store: store ) Connect authentication using AuthorizationInterceptor.
Schema Design for Mobile Screens
We analyze each app screen: what data is needed, with what frequency, what relations between entities exist. For example, for a product card in an e-commerce app — name, price, image, characteristics. The GraphQL query will be exactly that, without extra fields. This reduces load on server and client, and speeds up rendering.
What is Included in GraphQL API Development for Mobile Apps
- Schema design based on client requirements (mobile screens, query frequency).
- Resolver implementation with DataLoader and batching.
- Apollo Client setup on both platforms: cache, subscriptions, authentication.
- Persisted Queries integration to reduce traffic.
- Schema documentation in GraphQL Playground / GraphiQL.
Timeline: 2–4 weeks depending on schema size. We guarantee stable API operation under load. Contact us — we'll evaluate your project in one business day. Get a consultation on implementing GraphQL in your mobile app.







