Skip to content

Building Services

You have a .proto contract. This module turns it into something that actually runs: a server that answers calls, a client that makes them, and the deadline discipline that keeps the whole thing from hanging forever.

Every lesson uses the same tiny contract so you can follow one example end to end:

syntax = "proto3";
package user.v1;
message GetUserRequest {
int64 id = 1;
}
message User {
int64 id = 1;
string name = 2;
string email = 3;
}
service UserService {
rpc GetUser(GetUserRequest) returns (User);
}
LessonWhat you’ll learn
Code Generationprotoc, language plugins, buf, and exactly what gets generated
Implementing a ServerFilling in the handler, registering the service, and serving
Writing a ClientChannels, stubs, making the call, and reusing connections
Deadlines & CancellationWhy every call needs a deadline, and how it propagates
flowchart LR
  proto[".proto"] -->|protoc / buf| gen["generated code:
messages + stub + server interface"]
  gen --> srv["implement server
(fill GetUser)"]
  gen --> cli["write client
(call GetUser)"]
  cli -->|HTTP/2| srv
The build loop: generate, implement, call

Notice that the generated code sits in the middle: it hands the server an interface to implement and the client a stub to call. You write the two ends; codegen guarantees they agree.

What does the code generated from a .proto give you?
Why does every lesson in this module reuse the same UserService contract?
Which discipline keeps a gRPC call from hanging forever?