Skip to content
Tutorials Center
My learning

Topics

gRPC and Protocol Buffers Tutorial

Learn gRPC and Protocol Buffers step by step: 39 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 What Is gRPC? Learn what gRPC and Protocol Buffers are, why teams use them for service-to-service calls, and how a remote procedure call feels like a local function call.
  2. 2 gRPC vs REST and GraphQL Compare gRPC with REST and GraphQL: contracts, payload size, streaming, browser support, caching and tooling, and learn when each style is the right choice.
  3. 3 How gRPC Uses HTTP/2 See how a gRPC call maps to HTTP/2: streams, headers, the 5-byte message prefix and trailers that carry the status. Includes runnable Go stand-ins.
  4. 4 Installing protoc and the gRPC Plugins Install the protobuf compiler and language plugins for Go, Python and Java, compile your first .proto file, and see how code generation works with a runnable Go stand-in.
  5. 5 Your First gRPC Service: Hello World Build a complete Hello World gRPC service: write the contract, implement the server, call it from a client. Real code is shown, plus a runnable loopback TCP stand-in.

Protobuf Language

  1. 6 Protobuf Messages and Scalar Types Learn how to define protobuf messages, the scalar types (int32, sint64, string, bytes and more), default values, and how they map to Go, Java and Python types.
  2. 7 Field Numbers and the Protobuf Wire Format Understand how protobuf encodes messages: field numbers, wire types, varints and ZigZag, with runnable Go code that encodes and decodes real protobuf bytes.
  3. 8 Protobuf Enums, Repeated Fields and Maps Define enums with a safe zero value, repeated lists with packed encoding, and map fields in proto3, with runnable Go stand-ins for unknown values and packing.
  4. 9 oneof, optional and Well-Known Types Use oneof for alternatives, optional for field presence, and the well-known types Timestamp, Duration, Empty, Any, Struct and FieldMask. Includes runnable Go stand-ins.
  5. 10 Protobuf Packages, Imports, Nested Types and Options Organize .proto files with packages, imports, nested messages and file options such as go_package and java_package. Runnable Go stand-ins resolve names and order imports.

Services and RPC Types

  1. 11 Defining Services and Unary RPCs Define a gRPC service in a .proto file with unary methods, design request and response messages, follow naming and CRUD conventions, and see a typed method registry in Go.
  2. 12 Implementing a gRPC Server Implement the server side of a gRPC service: handler signatures, thread-safe state, validation, graceful shutdown and server options, with runnable Go stand-ins.
  3. 13 gRPC Clients, Channels and Stubs Learn how gRPC clients work: channels, stubs, connection reuse, dial options, retry policies and backoff. Real Go code is read-only; runnable Go stand-ins model reuse and retries.
  4. 14 gRPC Deadlines, Timeouts and Cancellation Learn why every gRPC call needs a deadline, how deadlines propagate across services, how servers detect cancellation, and how to handle DEADLINE_EXCEEDED, with runnable Go stand-ins.

Streaming

  1. 15 gRPC Server Streaming RPCs Learn server-streaming RPCs: define the stream in proto, send many messages from the server, read until EOF on the client, cancel early, and when to stream instead of paginate.
  2. 16 gRPC Client Streaming RPCs Learn client-streaming RPCs: the client sends many messages and receives one reply. Build chunked file uploads with checksums, with real code read-only and runnable Go stand-ins.
  3. 17 gRPC Bidirectional Streaming RPCs Learn bidirectional streaming in gRPC: both sides send independently on one call. See ping-pong and fully concurrent patterns, closing rules, and a chat-room design in runnable Go stand-ins.
  4. 18 gRPC Flow Control, Backpressure and Streaming Patterns Understand HTTP/2 flow control and backpressure in gRPC streams, bounded queues and drop policies, batching, and resumable streams. Includes runnable Go stand-ins.

Error Handling and Metadata

  1. 19 gRPC Status Codes Learn the 17 gRPC status codes, when to return each one, how they map to HTTP, and which are safe to retry, with runnable Go stand-ins and real grpc-go code.
  2. 20 Rich Error Details in gRPC Go beyond a status code and message. Attach structured details such as BadRequest and RetryInfo to gRPC errors, and decode them on the client, with runnable Go stand-ins.
  3. 21 gRPC Metadata, Headers and Trailers Understand gRPC metadata: request headers, response headers and trailers, key rules, binary values, and how to read and send them in Go, with runnable stand-ins.
  4. 22 gRPC Deadlines and Cancellation Learn why every gRPC call needs a deadline, how deadlines propagate across services, and how to honour cancellation in Go handlers, with runnable context examples.
  5. 23 gRPC Retries, Backoff and Hedging Configure gRPC retry policies with service config, understand exponential backoff, retry throttling, idempotency and hedging, with runnable Go simulations.

Interceptors and Security

  1. 24 gRPC Interceptors Explained Learn how gRPC interceptors work: unary and stream interceptors on client and server, chaining order, and how to write them in Go, with runnable middleware stand-ins.
  2. 25 Logging, Metrics and Recovery Interceptors Build production interceptors for gRPC in Go: structured logging, request IDs, latency metrics, and panic recovery that returns INTERNAL, with runnable examples.
  3. 26 TLS and Mutual TLS for gRPC Secure gRPC with TLS and mutual TLS: certificates, CAs, server and client credentials in Go, and a runnable in-memory mTLS handshake using the standard library.
  4. 27 Token Authentication and Authorization in gRPC Authenticate gRPC calls with bearer tokens and API keys: per-RPC credentials on the client, auth interceptors on the server, and role checks, with runnable HMAC token examples in Go.

Load Balancing and Gateways

  1. 28 gRPC Load Balancing Learn why gRPC needs special load balancing, compare proxy and client-side approaches, round robin, pick_first, weighted policies and name resolution, with runnable Go simulations.
  2. 29 gRPC Health Checking and Server Reflection Use the standard gRPC health checking protocol with Kubernetes and load balancers, and server reflection with grpcurl, with Go examples and a runnable health service simulation.
  3. 30 REST Transcoding with gRPC-Gateway Serve REST and JSON from a gRPC service with google.api.http annotations, grpc-gateway and Envoy transcoding, with a runnable Go path-template router and JSON mapping demo.
  4. 31 gRPC-Web, Envoy and Proxies Learn why browsers cannot speak native gRPC, how the gRPC-Web protocol and framing work, how Envoy or Connect bridge them, with a runnable Go frame encoder and decoder.

Testing and Versioning

  1. 32 Testing gRPC Services Test gRPC servers and clients in Go: handler unit tests, in-memory bufconn connections, fake clients, status code assertions, deadlines and streaming, with runnable examples.
  2. 33 Protobuf Schema Evolution and Compatibility Change protobuf schemas without breaking clients: safe and unsafe edits, field numbers, reserved, wire format compatibility and API versioning, with a runnable wire-format demo in Go.
  3. 34 Buf: Linting and Breaking-Change Detection Use the buf CLI to lint protobuf files, detect breaking changes against main, generate code and run it in CI, with runnable Go examples of lint and breaking-change rules.
  4. 35 gRPC Load Testing and Performance Tuning Measure gRPC performance with ghz and latency percentiles, then tune message size limits, compression, keepalive, connection use and streaming, with runnable Go measurements.

Projects and Practice

  1. 36 Project: A Key-Value Store Service Design and build a gRPC key-value store: proto contract, versioned values, compare-and-swap, TTL, watch streams, auth and errors, with a fully runnable Go implementation of the logic.
  2. 37 Project: A Chat Service with Bidirectional Streaming Build a gRPC chat service with bidirectional streams: protocol design, room broker, history replay, backpressure, rate limiting and graceful shutdown, with a runnable Go broker.
  3. 38 A gRPC Production Checklist A practical checklist for running gRPC services in production: API design, deadlines, retries, security, observability, shutdown and deployment, with runnable shutdown and config-audit examples.
  4. 39 Practice: gRPC and Protobuf Exercises Practice gRPC and protobuf skills with hands-on Go exercises on status codes, retries, interceptors and schema compatibility, plus design questions and full solutions.