← Lessons

quiz vs the machine

Platinum1800

Networking

The REST vs gRPC vs GraphQL

Choosing an API style by traffic, clients, and shape.

6 min read · advanced · beat Platinum to climb

Three Common Styles

REST, gRPC, and GraphQL solve overlapping problems with different trade offs. There is no single winner, only a fit for a context.

How They Differ

Each style makes a different bet on encoding and shape.

  • REST uses text over HTTP with resource URLs and verbs, easy to cache and explore.
  • gRPC uses binary over HTTP version two with a strict contract and streaming, fast for internal calls.
  • GraphQL uses a single endpoint where clients shape their own queries.

Picking One

The choice follows who calls the API and how.

  • For public web APIs that browsers and many clients hit, REST is simple and cacheable.
  • For internal service to service traffic that values speed and streaming, gRPC fits well.
  • For rich clients with varied data needs, such as mobile screens, GraphQL avoids many round trips.

The Honest Trade Offs

Each gain has a cost.

  • gRPC is fast but not browser friendly without a proxy, and traffic is opaque.
  • GraphQL is flexible but pushes cost and caching complexity to the server.
  • REST is universal but can cause over fetching and chatty calls.

Many real systems mix them, exposing REST or GraphQL at the edge and gRPC between internal services.

Key idea

REST, gRPC, and GraphQL trade off caching, speed, and query flexibility, so the right pick follows the callers, and many systems combine REST or GraphQL at the edge with gRPC between internal services.

Check yourself

Answer to earn rating on the learn ladder.

1. Which style is usually best for internal service to service speed and streaming?

2. What is a drawback of gRPC for public web clients?

3. How do many real systems combine these styles?