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
Graphql is very rare but gRPC should be the go to for machine to machine
Please......, GraphQL per the current implementation is the king of N + 1 queries (way more than well-built REST endpoints)
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
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
nope. Always use Rest
Isn’t graphql just using rest underneath?
GraphQL is like SQL for frontend 😂
GraphQL came around promising to replace REST, but barely anyone uses it. gRPC is still pretty green since browsers don't support it yet, so you'll need to change your infrastructure to make it work.
GraphQL is not worth it. I’d use ODATA if I need to filter data server side.
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.
What HTTP feature gives you retries for free...? If you are defaulting to synchronous APIs between services you are probably doing it wrong.
We use graphql in our company and we’re thinking about retiring it since it causes so many N+1 queries
Thank you for this 🙌
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.
You get HTTP mapping as well as an extra feature with gRPC. One Service supporting both comm. protocols (REST & gRPC)
Nice
default rest, graphql for headache' grpc internal
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.
for those who havent tried RPC, i would say, just try it, u wont ever going back to REST
REST is not a protocol btw