It is a protocol created by Google. it is based on HTTP 2 and uses protocol buffers for serialisation of data. gRPC was designed to handle high performance and low latency communication between microservices and support streaming, bidirectional streaming and Multiplexing. gRPC is often preferred for service-to-service communication due to its efficiency and support for advanced features like load balancing, tracing and authentication.

Pros

  • Smaller payload and better performances due to binary data serialisation, multiplexing which means that multiple requests are sent over a single HTTP 2 connection.

Cons

  • gRPC on the web requires a proxy as browsers do not support HTTP 2 natively
  • gRPC requires client libraries to work in different languages which may add complexity in some cases.

Concepts

gRPC Modes

Libraries & Technologies

@grpc/grpc-js - Client/server for gRPC.
@grpc/proto-loader - To convert data to bytes in runtime and to generate types
ts-proto - To generate a stub from a protofile using typescript. Can be used with
connectRPC a collection of libraries for building browser and gRPC compatible APIs.