← Concepts
Communication·3 min read

REST vs gRPC vs GraphQL

Three API styles: REST is the universal default, gRPC is fast binary RPC for service-to-service, GraphQL lets clients ask for exactly the data they want.

First time reading this? Start here

Plain English: REST is the standard 'GET this URL' API everyone knows. gRPC is a faster, binary protocol for servers talking to each other internally. GraphQL lets the client say 'give me exactly these fields' in one request instead of calling five endpoints. Each fits a different job.

Used in:NetflixTwitter Home TimelineUber
What it is

Three approaches to API design. REST uses HTTP verbs and resource URLs with JSON: simple, cacheable, universally supported. gRPC is a binary RPC framework over HTTP/2 using Protocol Buffers: strongly typed, fast, with streaming. GraphQL is a query language where the client specifies exactly which fields it needs from a typed schema, fetched through a single endpoint.

The problem it solves

Different API consumers have different needs. REST is the right default for public APIs and CRUD, since it's cacheable and every tool understands it. gRPC solves the overhead of JSON-over-HTTP/1.1 for chatty internal service-to-service calls. GraphQL solves over-fetching and under-fetching for clients (especially mobile) that would otherwise make many round-trips to assemble one screen.

How it works

REST: client hits resource URLs (GET /users/1) with HTTP verbs; responses are JSON; HTTP caching and status codes do real work. gRPC: define services and messages in a .proto file, codegen typed client/server stubs; calls are binary over HTTP/2 with multiplexing and bidirectional streaming. GraphQL: define a typed schema; clients send a query naming exactly the fields they want; a resolver layer fetches and assembles the response in a single round-trip.

Why use it
What it costs you
Where it shows up in our architectures
Gotchas

Your notes

Private to you