Networking & Protocols (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the difference between REST, GraphQL, and gRPC?
senior LevelSystem DesignGraphQLgRPC
In Simple Words:
- REST: Resource-oriented URLs (
GET /users/1), HTTP methods, JSON payloads. Mature, standard for public third-party APIs. Prone to over-fetching and under-fetching. - GraphQL: Query-language API. Client specifies the exact fields it needs in a single POST request (
{ user { name, orders { id } } }), eliminating over-fetching. Best for complex client frontend applications. - gRPC: High-performance RPC framework by Google. Uses Protocol Buffers (Protobuf) binary serialization over HTTP/2 transport. Strongly typed contracts (
.proto), streaming support, 7x-10x faster than REST/JSON. Industry standard for internal backend microservice-to-microservice communication.