0:00
1:13
1:13

REST vs GraphQL vs gRPC: Which API wins in system design interviews?

Tech

REST is not the answer to every API question, and if that's all you say in a system design interview, you might be in trouble. There are three protocols worth knowing, and each one has a job. REST is certainly your default for CRUD options. Resources as URLs, verbs as actions, and it rides on top of HTTP so you inherit caching, retries, and status codes for free. Then there is GraphQL, which is great for product UIs that need flexible, nested data. Clients write a query describing exactly the shape they want, and the server returns that — no more, no less. One round trip instead of a dozen like their might be with REST. Lastly, gRPC is for internal service-to-service calls where you want speed and strict contracts. Binary over HTTP/2, Protobuf schemas generate typed clients in every language, and you get streaming and multiplexing built in. It's significantly faster than JSON over REST when you're making millions of calls between services. \ So in the interview: default to REST, reach for GraphQL when the client needs flexible or deeply nested data, and drop gRPC when you're designing internal service communication at scale. Match the tool to the job. Watch the full video breakdown on hellointerview.com #shorts

ADVERTISEMENT

Comments 23

Sign in to join the conversation

Sign in
A
agathe_prévost 1 week, 3 days ago

default rest, graphql for headache' grpc internal

C
charles_renard 1 week, 3 days ago

REST is not a protocol btw

L
leon.mohaupt 1 week, 6 days ago

You get HTTP mapping as well as an extra feature with gRPC. One Service supporting both comm. protocols (REST & gRPC)

micheal.turner
micheal.turner 2 weeks ago

for those who havent tried RPC, i would say, just try it, u wont ever going back to REST

scottarc94
scottarc94 2 weeks, 1 day ago

We use graphql in our company and we’re thinking about retiring it since it causes so many N+1 queries

V
vasudhamalhotra949 2 weeks, 1 day ago

Buzzword buzzword buzzword

I
irmela_bärer 2 weeks, 3 days ago

Graphql is very rare but gRPC should be the go to for machine to machine

V
vincent_webb 2 weeks, 3 days ago

GraphQL is great for super niche frontends but its a terrible API design in general for 3rd party consumers, compared to REST and anyone who says otherwise either works in super niche stuff, or just tried GQL first and thinks its better because its newer

M
meganseraph65 2 weeks, 4 days ago

GRPC can be used for external API calls as well but requires vertical integration between the client and server. Extreme optimization for efficiency for loss of flexibility.

B
beth.cisneros 2 weeks, 4 days ago

I would not call any of those protocol...

R
robertvaleon36 2 weeks, 4 days ago

Also, gRPC is ONLY for when coupling 2 or more physical servers is desirable. No more, no less. GraphQL is the king 👑 of N +1 queries and it's too much overhead.

L
lucieadam19 2 weeks, 4 days ago

Please......, GraphQL per the current implementation is the king of N + 1 queries (way more than well-built REST endpoints)

S
stéphane.perrin 2 weeks, 4 days ago

Isn’t graphql just using rest underneath?

tracey_ramos
tracey_ramos 2 weeks, 4 days ago

nope. Always use Rest

melanie.campbell
melanie.campbell 2 weeks, 4 days ago

What HTTP feature gives you retries for free...? If you are defaulting to synchronous APIs between services you are probably doing it wrong.

M
marcelladörschner483 2 weeks, 4 days ago

GraphQL is not worth it. I’d use ODATA if I need to filter data server side.

L
lilia_medrano 2 weeks, 4 days ago

SOAP is worth knowing as many APIs use this

L
liabeier261 2 weeks, 4 days ago

why can't rest give exactly what is needed ? accept a parameter to know what shape is needed and return that. This is not scalable but to serve a few diff use cases is olenty.

M
maria_evans 2 weeks, 4 days ago

Thank you for this 🙌

C
corinne.daniel 2 weeks, 4 days ago

GQL's only advantage is type coordination between the front and backend. I don't think there's much to gain by controlling which fields to load. You can argue that it reduces the payload size, but your can customize each REST endpoint to return exactly the data needed and nothing more