# gRPC and Protocol Buffers

> Build fast, strongly typed service-to-service APIs with protobuf contracts and HTTP/2 streaming. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/backend/grpc
Last updated: 2026-11-28

Build fast, strongly typed service-to-service APIs with protobuf contracts and HTTP/2 streaming.

Advanced · about 6 hours · difficulty 3/5

Learn first: [Resource-Oriented REST APIs](https://www.internhack.in/roadmaps/tracks/backend/rest-api-design)

**gRPC** is a remote procedure call framework: you define services and messages in a `.proto` file with **Protocol Buffers**, generate client and server code for many languages, and call remote methods as if they were local functions. It runs over HTTP/2 and encodes data in a compact binary format.

### Why teams use it

- **Performance**: binary encoding and HTTP/2 multiplexing are faster and smaller than JSON over HTTP/1.1.
- **Strong contracts**: the `.proto` file is the source of truth, and generated code catches mismatches at compile time.
- **Streaming**: server streaming, client streaming and bidirectional streaming are built in.

### Where it fits

Mostly **internal service-to-service** communication in microservice systems. Browsers cannot speak native gRPC directly; you need gRPC-Web or a JSON gateway, so public APIs usually stay REST or GraphQL.

### Things to learn

- Proto syntax, field numbers and why you must never reuse a removed field number.
- Deadlines (timeouts) and status codes.
- Tooling like `grpcurl` and **Buf** for linting and breaking-change detection.

You are ready to move on when you have two small services talking over gRPC with a deadline set on every call.

## Key concepts

- **Protocol Buffers syntax**
- **Code generation**
- **Unary and streaming RPCs**
- **Deadlines and status codes**
- **Backward-compatible proto changes**
- **gRPC-Web and gateways**
- **grpcurl and Buf**

## Mini project

Create an inventory service exposing a gRPC CheckStock method and call it from an order service, including a server-streaming method for stock updates.

## Check yourself

Why must you never reuse the field number of a removed protobuf field?

## Free resources

- [gRPC documentation](https://grpc.io/docs/) (gRPC)
- [Protocol Buffers documentation](https://protobuf.dev/) (Google)

Previous: [GraphQL APIs](https://www.internhack.in/roadmaps/tracks/backend/graphql) · Next: [SOAP and Legacy Integrations](https://www.internhack.in/roadmaps/tracks/backend/soap-legacy-apis)

## More in Designing and Documenting APIs

- [Resource-Oriented REST APIs](https://www.internhack.in/roadmaps/tracks/backend/rest-api-design)
- [Pagination, Versioning and Rate Limits](https://www.internhack.in/roadmaps/tracks/backend/api-evolution-and-limits)
- [API Contracts with OpenAPI](https://www.internhack.in/roadmaps/tracks/backend/openapi-docs)
- [GraphQL APIs](https://www.internhack.in/roadmaps/tracks/backend/graphql)
- [gRPC and Protocol Buffers](https://www.internhack.in/roadmaps/tracks/backend/grpc)
- [SOAP and Legacy Integrations](https://www.internhack.in/roadmaps/tracks/backend/soap-legacy-apis)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
