Black Friday: 30% off every plan through November 30. See the prices
SysDesignPrep.com
Study guide

Updated 24 October 2026

REST vs gRPC vs GraphQL

Choosing an API style: REST, gRPC and GraphQL compared on data format, performance, typing, caching, streaming, browser support, versioning and tooling, with typical uses for public APIs, internal service calls and client-driven data fetching.

Reading is half of it. Now try it in an interview.An AI interviewer asks you to design a URL Shortener, out loud or typed, and scores the answer for your level. Or watch a sample interview first, free with no sign-up.
Start an AI mock

Try it yourself, in a playground:N+1 queries

Every design has APIs, and interviewers sometimes ask why you chose REST over gRPC or GraphQL. There is no universally right answer, but there are clear patterns: REST for public and simple APIs, gRPC between internal services, GraphQL when many different clients need flexible views of connected data. Knowing the trade-offs lets you answer in one confident sentence.

REST

Resources identified by URLs, manipulated with HTTP methods (GET /orders/42, POST /orders), usually with JSON bodies.

  • Universal: every language, browser, tool and developer understands it.
  • HTTP caching works naturally for GET requests, including CDNs. See HTTP caching.
  • Human-readable and easy to debug with curl.
  • Weaknesses: over-fetching (fields you do not need) and under-fetching (several calls for one screen), loose typing unless you add OpenAPI schemas, and JSON is relatively large and slow to parse.

gRPC

Remote procedure calls defined in Protocol Buffers (rpc GetOrder(GetOrderRequest) returns (Order)), over HTTP/2.

  • Compact and fast: binary Protobuf encoding and multiplexed HTTP/2 connections. See serialization formats.
  • Strong contracts with generated client and server code in many languages.
  • Streaming: server, client and bidirectional streams built in.
  • Deadlines and cancellation propagate across calls, which helps with tail latency.
  • Weaknesses: browsers cannot call it directly (gRPC-Web or a proxy is needed), harder to inspect by hand, and HTTP caching does not apply.

GraphQL

A single endpoint where the client sends a query describing exactly the fields it wants, across related objects; a schema defines types and resolvers fetch the data.

  • No over- or under-fetching: one request returns exactly what a screen needs.
  • Strongly typed schema with great tooling and introspection.
  • Clients evolve without new endpoints; fields are deprecated rather than versioned.
  • Weaknesses: caching is harder (POST to one endpoint; needs persisted queries or client-side caches), expensive or deeply nested queries must be limited, the N+1 resolver problem needs batching (DataLoader-style), and the server is more complex.

Comparison

RESTgRPCGraphQL
FormatJSON (usually)Protobuf (binary)JSON
Contractoptional (OpenAPI)required (.proto)required (schema)
Performancegoodbestgood, depends on resolvers
Browser supportnativevia gRPC-Web or a proxynative
HTTP cachingexcellentnonelimited
Streamingvia SSE or WebSocketsbuilt insubscriptions
Fetching flexibilityfixed per endpointfixed per methodclient chooses fields
Typical usepublic APIs, simple CRUD, webhooksinternal service-to-serviceclient-facing aggregation over many services

Common combinations

  • Public API: REST with OpenAPI, versioned, with API keys and rate limits. See API design.
  • Internal microservices: gRPC with Protobuf, deadlines and generated clients. See microservices.
  • Mobile and web apps with complex screens: a GraphQL layer (or a backend for frontend) in front of internal gRPC services, aggregating data per screen. See API gateways.
  • Real-time: WebSockets or SSE alongside any of these. See WebSockets vs SSE vs long polling.

Large companies often use all three: Netflix and others use GraphQL federation for clients and gRPC internally. See Design Netflix.

Versioning

  • REST: additive changes in place, breaking changes under /v2 or a version header.
  • gRPC: Protobuf field rules (never reuse tags), package versions for breaking changes.
  • GraphQL: add fields freely, deprecate old ones, and remove them only when usage is zero (tracked per field).

In the interview

You rarely need to debate this for long. Say: "The public API is REST with JSON because it is cacheable and easy for clients; services talk to each other over gRPC for typed contracts, speed and deadlines." Add GraphQL or a BFF when clients need data from many services per screen, as in Design DoorDash or Design Instagram. For a simple service like Design a URL Shortener, REST alone is fine.

Checklist

  • REST for public, simple and cacheable APIs.
  • gRPC for internal calls: contracts, performance, streaming, deadlines.
  • GraphQL or BFFs when clients need flexible, aggregated data.
  • Versioning and compatibility rules per style.
  • Query cost limits and batching for GraphQL; gRPC-Web or proxies for browsers.

Questions people ask

What is the difference between REST, gRPC and GraphQL?

REST exposes resources at URLs manipulated with HTTP methods, usually with JSON bodies; gRPC defines remote procedure calls in Protocol Buffers over HTTP/2; GraphQL offers a single endpoint where the client queries exactly the fields it wants. The usual pattern is REST for public and simple APIs, gRPC between internal services, and GraphQL when many different clients need flexible views of connected data. HTTP caching is excellent for REST, limited for GraphQL and absent for gRPC.

When should you use gRPC instead of REST?

Use gRPC for internal service-to-service calls, where binary Protobuf encoding, multiplexed HTTP/2 connections, generated clients, built-in streaming and propagated deadlines pay off. Use REST for public and simple APIs, because every language, browser and developer understands it and GET requests cache naturally, including on CDNs. gRPC's weaknesses are that browsers cannot call it directly without gRPC-Web or a proxy, it is harder to inspect by hand, and HTTP caching does not apply.

When should you use GraphQL instead of REST?

Use GraphQL when mobile and web apps with complex screens need data from many services per screen. One query returns exactly the fields a screen needs, avoiding the over-fetching and under-fetching of fixed REST endpoints, and clients evolve without new endpoints. The costs are harder caching, because queries POST to one endpoint, limits on expensive or deeply nested queries, the N+1 resolver problem that needs batching, and a more complex server.

Is gRPC faster than REST?

Usually, yes: gRPC uses compact binary Protobuf encoding and multiplexed HTTP/2 connections, while REST typically sends JSON, which is relatively large and slow to parse. gRPC also propagates deadlines and cancellation across calls, which helps with tail latency. REST keeps an advantage in caching, because GET requests work naturally with HTTP caches and CDNs, which gRPC cannot use.

Can browsers call gRPC directly?

No: browsers need gRPC-Web or a proxy to call a gRPC service. That is one reason gRPC is mostly used between internal services, while browser-facing APIs use REST or GraphQL, both of which browsers support natively. A common setup puts a GraphQL layer or a backend for frontend in front of internal gRPC services, aggregating data per screen.

How do you version REST, gRPC and GraphQL APIs?

REST makes additive changes in place and puts breaking changes under /v2 or a version header. gRPC follows Protobuf field rules, never reusing tags, and uses package versions for breaking changes. GraphQL adds fields freely, deprecates old ones and removes them only when their usage, tracked per field, reaches zero.