Part 7 of 22 · System Design

REST vs GraphQL vs gRPC for internal services: which one?

REST for public and simple APIs, GraphQL where many clients need different shapes of the same data, gRPC between your own services when latency and strict contracts matter. What each one is good at, what it costs, and how to choose per boundary, not per company.

Two grey US Mail mailboxes side by side, two ways to send a message

The verdict, which the scenes below earn: choose per boundary.

  • REST over HTTP and JSON is the default for public APIs, webhooks and simple service-to-service calls: universally understood, easy to cache and debug.
  • GraphQL fits a backend-for-frontend layer, where many clients (web, mobile, partners) need different shapes of the same data and you want one round trip per screen.
  • gRPC (Protocol Buffers over HTTP/2) fits calls between your own services when you want strict, generated contracts, streaming and low overhead.

Many systems use all three, each where it fits.

Case file

The case Four round trips per screen, a partner who can’t call the API, a pricing chain over budget
Suspects REST, GraphQL, gRPC
Culprit One protocol picked for every boundary
The fix Choose per boundary: who is calling, and what do they need?

The case #

A mobile home screen takes four round trips to load. A partner can’t figure out how to call your API from their tooling. An internal pricing chain keeps blowing its latency budget. Three different complaints, and three suspects that get argued about as if only one could be right.

This case has no single culprit. Each of these was designed with a clear view of who’s on the other end of the call, and that one assumption, the motive if you like, shapes everything else about them.

The suspects at a glance #

Put side by side, their different priorities are easy to see:

REST (JSON over HTTP) GraphQL gRPC
Contract OpenAPI (optional, often drifts) Schema (required, typed, introspectable) .proto files (required, code generated)
Shape of responses Fixed per endpoint The client asks for exactly the fields it needs Fixed per method
Round trips per screen Often several Usually one Several, or one aggregated method
Caching HTTP caching and CDNs work out of the box Hard at the HTTP layer (mostly POST to one URL); needs app-level caching Not HTTP-cacheable; app-level
Streaming Server-sent events, WebSockets, chunked responses Subscriptions (usually over WebSockets) Built in: server, client and bidirectional streams
Browser support Native Native (it’s HTTP) Needs gRPC-Web or a gateway
Payload and speed Text JSON Text JSON, plus query parsing and resolution Compact binary, HTTP/2 multiplexing
Debugging curl and any browser GraphiQL and similar, curl with a query Needs grpcurl or generated clients
Main risks Over- and under-fetching; versioning sprawl Expensive queries (N+1 resolvers, deep nesting); authorisation per field Tight coupling through shared protos; harder to inspect; browser friction

Use case 1: service-to-service calls with tight latency budgets #

The scene: a pricing service calls inventory and rules services on every quote, many times a second, and the whole chain must stay within a few tens of milliseconds.

What I’d use: gRPC.

  • Generated clients and servers from one .proto file mean a breaking change fails the build, not production.
  • HTTP/2 keeps a few long-lived connections and multiplexes calls over them; binary encoding keeps payloads small.
  • Deadlines travel with the call, so a slow downstream service doesn’t hold resources past the caller’s own timeout.

Mind the contract discipline: never reuse or renumber field tags; add fields, don’t change them; keep protos in one shared place with review. And beware a common false lead: measure before assuming JSON is your bottleneck. For most internal calls, the database and the network dominate, not serialisation. Whichever protocol you pick, the service-to-service auth case covers how the callee knows who’s calling.

Use case 2: a backend-for-frontend aggregating several services #

The scene: a mobile app’s home screen needs the user, their recent orders, recommendations and unread notifications, owned by four different services. On a mobile network, four round trips are slow.

What I’d use: GraphQL as a backend-for-frontend.

  • The client asks for exactly what the screen needs, in one request. That inversion, letting the client describe the shape it wants, is GraphQL’s central idea, and a genuinely elegant one. The server fans out to the services and assembles the answer.
  • One schema documents everything clients can ask for, and tooling generates typed clients from it.
  • Federation lets several teams each own part of one graph, served through a router as a single API.

That flexibility has a price, and the usual accomplices are well known:

  • N+1 resolvers: fetching a list, then each item’s details one by one. Batch them (a DataLoader-style batcher), or the database pays (the slow-page debugging case shows what N+1 costs).
  • Unbounded queries: a client can ask for deeply nested data. Limit depth and complexity, and consider persisted (allow-listed) queries for production clients.
  • Authorisation per field, not only per endpoint.
  • Caching moves into the app, because most queries are POSTs to a single URL.

At Bondify, the Template.io contract-drafting engine’s MVP was delivered in two quarters through both REST and GraphQL APIs, with API contracts and service boundaries agreed with the product and frontend teams up front. That’s typical: GraphQL for the product UI’s flexible needs, REST where a simple, stable endpoint was enough. My federated GraphQL sample shows the federation pattern on a small example.

Use case 3: a public or partner API #

The scene: customers and partners integrate with your platform from every language and tool, and many send you webhooks.

What I’d use: REST with JSON, and an OpenAPI description.

  • Anyone can call it with any HTTP client, including curl in a support ticket.
  • HTTP semantics do real work, and you get them for free: status codes, the Idempotency-Key header convention for POST (still an IETF draft, but widely used), ETags and conditional requests for safe updates (the locking case shows If-Match), and caching through CDNs.
  • Versioning by URL or header, with deprecation windows.

Offer GraphQL to partners only if they need flexible queries, and gRPC only to partners who ask for it.

The reveal: choosing per boundary #

Put all the clues together and the answer depends on who’s calling:

Boundary Default Choose otherwise when
Public / partner API REST Partners need flexible querying (GraphQL), or high-throughput streaming (gRPC)
Web and mobile app to backend REST, or GraphQL as a backend-for-frontend Screens combine data from many services, or several client types need different shapes
Service to service REST, or gRPC gRPC when latency, streaming or strict contracts matter and both ends are yours
Events between services Neither: a queue or event bus Neither (the messaging post)
Flowchart: Does the caller need an answer now?, Events: a queue or event bus, Who is calling?, Public or partner, REST + OpenAPI, App screens across many services, GraphQL backend-for-frontend, Your own service, tight latency, gRPCFlowchart: Does the caller need an answer now?, Events: a queue or event bus, Who is calling?, Public or partner, REST + OpenAPI, App screens across many services, GraphQL backend-for-frontend, Your own service, tight latency, gRPC
Diagram source
flowchart TD
  Q0{"Does the caller need an answer now?"}
  Q0 -->|no| EV["Events: a queue or event bus"]
  Q0 -->|yes| Q1{"Who is calling?"}
  Q1 -->|"Public or partner"| REST["REST + OpenAPI"]
  Q1 -->|"App screens across many services"| GQL["GraphQL backend-for-frontend"]
  Q1 -->|"Your own service, tight latency"| GRPC["gRPC"]

Remember this

  • Choose per boundary, not per company.
  • GraphQL buys one round trip per screen and costs batching, query limits and field-level authorisation.
  • Measure before blaming JSON: the database and network usually dominate.

What I’d do on Monday #

  1. REST with OpenAPI for anything public, and for internal calls until there’s a reason to change.
  2. GraphQL as a backend-for-frontend when several clients and many services meet at the UI, with batching, query limits and field-level authorisation from day one.
  3. gRPC between your own services where latency or contracts are worth the tooling.
  4. Events, not calls, for anything that doesn’t need an answer now.
  5. Contracts in version control, reviewed like code, and checked in CI for breaking changes.

Once you stop asking “which one is guilty?” and start asking “who is calling, and what do they need?”, all three become useful tools, each in its own place.

Like (sign in first) 0 likes 💬 0

Written by

Vishal Kumar

Associate Director at CapGrid, running product and engineering in a CPTO capacity. 10+ years building distributed, multi-tenant SaaS and AI platforms. AWS Certified Solutions Architect - Professional. Based in Gurugram.

Comments

No comments yet.

Sign in to comment. We'll email you a link; no password needed.