open source · conference talk

The ProtobufProject

One schema, the whole backend.

How a single .proto becomes storage, services, REST, streams, SDKs and AI tools.

Srikanth K · oh-tarnished.devthe-protobuf-project.orggithub.com/the-protobuf-project
Who I amThe Protobuf Project

Who I am · Bengaluru

I’m Srikanth K.

I work on seams: the places where two systems have to agree on something, and don’t.

Robots and the cloud · five yearsOrdered telemetry, commands that survive partitions

Including a humanoid robot that guided patients through surgery in San Diego. Most of that work wasn’t robotics.

Buildings and software · nowThe same problem, with harder protocols

One queryable model of spaces, equipment and points over BACnet, KNX, DALI, OSDP and ONVIF, in Go and Rust.

Why this projectEvery seam was a schema, written more than once

Proto, migration, ORM model, OpenAPI, SDK. None could see the others. I wanted to write it once.

oh-tarnished.devgithub.com/oh-tarnishedlinkedin.com/in/srikanthkandarpx.com/srikanthkandarp
the-protobuf-project.org02 / 25
Where it startedThe Protobuf Project

The inception

An idea for two years.Code for nine months.

“I had the idea. I didn’t have a way to show it.”

late 2024Schema first, as an idea

Write the contract once; derive the database, the API and the clients from it. Nothing to show it with yet.

2025One person, too many generators

Proving it means a generator per target, each agreeing with the others. Too much to hand-write alone.

early 2026Claude, friends, colleagues

Building for real, with people I trust, asking one question: does a schema hold a whole backend?

today17 repositories, one schema

Generate natively, compile, deploy whenever you like. The rest of this talk is how.

the-protobuf-project.org03 / 25
How we got hereThe Protobuf Project

A short history

Four webs. One recurring problem.

Web 1 · 1991 – 2005Web 2 · 2005 – 2020Web 3 · from 2015Web 4 · from 2024 · my name for it
Forms for people, SOAP for machines
POST · HTTPSQLHTMLSOAP · XML
Browsera form
PHP scriptsave it, show it
MySQLa table per form
HTML pagebuilt on the server
Partner systemWSDL contract

the contractHTML forms for people; WSDL and XML for machines.

Apps speak JSON to many services
JSONJSONevents
Web app
Mobile app
API gatewayload-balanced
Users service
Orders service
Payments service
CacheRedis
BrokersKafka · RabbitMQ
Postgresa database each

the contractJSON won over XML. OpenAPI described it, beside the code, drifting from it.

Your data can live on a blockchain
transactionsignedreads
dAppthe same UI
Walletsigns the write
RPC nodeJSON-RPC
Chainstate, not rows
Contract ABIthe schema, again

the contractA contract ABI. The API on top is still a resource with CRUD.

AI agents call your APIs
tools/callA2A task
Youask in words
Agentan LLM + tools
MCP servertools, JSON Schema
Another agentAgent Card
Your servicesthe same CRUD

the contractA JSON Schema per tool, an Agent Card per agent. A schema, again.

the-protobuf-project.org04 / 25
Break HTTP firstThe Protobuf Project

Layer one

HTTP moves bytes.It doesn’t know your data.

request
POST /v1/shelves/1/books HTTP/1.1
Host: api.shop.example.com
Content-Type: application/json
{"title": "Dune", "pages": "412"}
response
HTTP/1.1 201 Created
Content-Type: application/json
{"name": "shelves/1/books/42", "title": "Dune", "pages": "412"}
what HTTP knows

A verb, a path, headers, a body, a status code.

what it doesn’t

That title is required, that pages is a number (it just got a string), that shelf 1 exists.

so the contract lives

In a wiki, an OpenAPI file, a Postman collection. Kept beside the code, where the two can drift.

HTTP/2

Same meaning, binary frames, many streams on one connection. The ground gRPC is built on.

the-protobuf-project.org05 / 25
Then break ProtobufThe Protobuf Project

Layer two

Protobuf isn’t a serializer.It’s a schema.

believed: “a faster JSON that gRPC uses”actually: messages + services + optionsthe wire format: one rendering of it
Protobuf binary application/grpc+proto
0a127368656c7665732f312f626f6f6b732f3432120444756e65189c032001

Underlined: the tag, field number << 3 | wire type. No names on the wire, only numbers.

31 B
JSON application/json
{
"name": "shelves/1/books/42",
"title": "Dune",
"pages": 412,
"available": true
}

Same message, same schema. gRPC's codec is pluggable: JSON, FlatBuffers, Cap'n Proto, or your own.

77 B
the-protobuf-project.org06 / 25
Now gRPCThe Protobuf Project

Layer three

gRPC = contract+ codec + HTTP/2.

client

generated stub

server

generated base

codec: proto · json · yoursHTTP/2 frames
unary
server stream
client stream
bidi stream

Plus deadlines, cancellation, status codes and metadata, defined once for every language.

codec.go · grpc-go
// the codec is a registry, not a given
import "google.golang.org/grpc/encoding"
type jsonCodec struct{}
func (jsonCodec) Name() string { return "json" }
func (jsonCodec) Marshal(v any) ([]byte, error) {
return protojson.Marshal(v.(proto.Message))
}
// …Unmarshal likewise
encoding.RegisterCodec(jsonCodec{})
// same service, same stub, JSON on the wire:
client.GetBook(ctx, req,
grpc.CallContentSubtype("json"))

Content type becomes application/grpc+json. FlatBuffers and Cap’n Proto plug in the same way.

the-protobuf-project.org07 / 25
The whole stackThe Protobuf Project

Same thing, different names

Every protocol isfour choices.

Transport, encoding, call shape, contract. MCP and A2A included.

Contractwhat exists, what is required, how it relates
Protocolhow a call is shaped
Encodinghow a value becomes bytes
Transporthow bytes move
REST
OpenAPI
verbs + paths
JSON
HTTP/1.1
GraphQL
SDL
query / mutation
JSON
HTTP + WebSocket
gRPC
.proto
service / rpc
proto binary · pluggable
HTTP/2
MCP
tool JSON Schema
JSON-RPC 2.0
JSON
stdio · Streamable HTTP
A2A
Agent Card
JSON-RPC · gRPC
JSON · proto
HTTP(S) · SSE

Only the top row is about your business. Write it once, and the supported columns below it are generated.

the-protobuf-project.org08 / 25
How systems get writtenThe Protobuf Project

The usual way

One resource.Nine hand-written copies.

message Bookthe one idea
SQL migrationwritten by hand · drifts
SQL migrationgenerated · store
ORM model + repositorywritten by hand · drifts
ORM model + repositorygenerated · store
Handlers: validation, pagination, masks, etagswritten by hand · drifts
Handlers: validation, pagination, masks, etagsgenerated · service
REST routes + OpenAPI documentwritten by hand · drifts
REST routes + OpenAPI documentgenerated · http · openapi
Read-through cachewritten by hand · drifts
Read-through cachegenerated · cache
Kafka / NATS producers + consumerswritten by hand · drifts
Kafka / NATS producers + consumersgenerated · streams
MCP server for AI agentswritten by hand · drifts
MCP server for AI agentsgenerated · mcp
Client SDK per languagewritten by hand · drifts
Client SDK per languagegenerated · sdk
Logs, metrics, traceswritten by hand · drifts
Logs, metrics, tracesgenerated · telemetry
the-protobuf-project.org09 / 25
Learn it from its makersThe Protobuf Project

Learn it from the people who built it

Google wrote protobuf.Then wrote down the rules.

We learned protobuf as gRPC’s wire format. Google uses it as an API design language, and published how.

Googleruns on protobuf
Protocol Buffers2001 · open 2008
AIPsgoogle.aip.dev
api-linterthe AIPs, as rules
Every Google APICloud, Ads, Maps
AIP-121Resource-oriented designnouns with standard verbs, not RPCs per screen
AIP-122Resource namesshelves/1/books/42: an address, a key, a URL
AIP-131 – 135Standard methodsGet, List, Create, Update, Delete, the same everywhere
AIP-158 · 160Pagination and filteringpage tokens and one filter grammar
AIP-193Errorsa reason, a domain, metadata: errors a program can read
AIP-203Field behaviorREQUIRED, OUTPUT_ONLY, IMMUTABLE, said in the schema
the-protobuf-project.org10 / 25
The AIP linterThe Protobuf Project

api-linter · in the editor and in CI

The AIPs, checkedbefore anyone reviews.

Each rule is named after its AIP. Each finding links to it.

findingsfindings
book.protoyou write
api-lintercore:: rules
VS Codeexplain + fix
GitHub ActionPR annotations
19 / 26rules a real service triggers, fixed in one keystrokecitedVS Code extension README
inlinefindings on the pull request diff, plus a summarycitedsetup-google-api-linter
terminal
$ api-linter shop/v1/book.proto
shop/v1/book.proto:9:3
core::0203::field-behavior-required
google.api.field_behavior annotation must be set
on "title" and contain one of, {"IMMUTABLE",
"OPTIONAL", "OUTPUT_ONLY", "REQUIRED"}
linter.aip.dev/203/field-behavior-required
the fix
// before
string title = 2;
// after the quick fix
string title = 2 [(google.api.field_behavior) = REQUIRED];
the-protobuf-project.org11 / 25

The schemais the network.

Not the JSON on the wire. The agreement underneath it. Write it down once, in a form a machine can read, and everything downstream is derived instead of authored.

— “Why this project exists”, the-protobuf-project.org/blog

The schema you already writeThe Protobuf Project

Protobuf + Google AIP

It already carries the decisions.

shop/v1/book.proto
syntax = "proto3";
package shop.v1;
message Book {
option (google.api.resource) = {
pattern: "shelves/{shelf}/books/{book}"
};
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
string title = 2 [
(google.api.field_behavior) = REQUIRED,
(buf.validate.field).string.max_len = 200];
int32 pages = 3;
string author = 4
[(google.api.resource_reference).type = "shop.example.com/Author"];
google.protobuf.Timestamp create_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
}
service BookService {
rpc GetBook(GetBookRequest) returns (Book) {
option (google.api.http) = { get: "/v1/{name=shelves/*/books/*}" };
}
}
google.api.resourcenames, URLs, parent and child
store · http · resourcename
field_behaviorNOT NULL, server-set, immutable
store · service
buf.validatechecks before your code runs
service · mcp tool schemas
resource_referencea foreign key, in plain sight
store
google.api.httpthe REST route and its OpenAPI
http · openapi
standard methodsAIP-131 to 135, by name and shape
service · sdk · mcp
the-protobuf-project.org13 / 25
Built like a compilerThe Protobuf Project

Intermediate representation

Built like a compiler.

Many inputs, one IR, many targets: N plus M parts instead of N times M.

a compiler · LLVM
loweremit
clangC and C++
rustcRust
swiftcSwift
LLVM IRone model
x86-64Intel, AMD
ARM64Apple, Graviton
WebAssemblythe browser
add.c · source
int add(int a, int b) {
return a + b;
}
add.ll · LLVM IR, generic
define i32 @add(i32 %a, i32 %b) {
%sum = add i32 %a, %b
ret i32 %sum
}
emitted · per machine
; x86-64
lea eax, [rdi + rsi]
ret
; ARM64
add w0, w0, w1
ret
the protobuf project · protokit
loweremit
protoc · buf.proto + AIP
idl2protofrom GraphQL
gnosticfrom OpenAPI
protokitschema · service IR
protoc-gen-storeSQL, repositories
protoc-gen-serviceGo, Rust servers
protoc-gen-mcpAI tools
book.proto · source
message Book {
option (google.api.resource) = {
pattern: "shelves/{s}/books/{b}"
};
string title = 2
[(google.api.field_behavior) = REQUIRED];
}
schema IR · JSON, illustrative
{
"table": "books",
"parent": "shelves",
"columns": [
{ "name": "name", "key": true },
{ "name": "title", "required": true }
]
}
emitted · illustrative
-- protoc-gen-store
title TEXT NOT NULL,
-- protoc-gen-mcp
"required": ["title"]
the-protobuf-project.org14 / 25
How it worksThe Protobuf Project

How it works

One file in.One binary out.

Every plugin reads the same model, so no decision is reimplemented per output.

book.protoAIP-annotated
buf generateone command
protokit IRone model
storeSQL · repositories
servicemethods · hooks
http · openapiREST + docs
mcpAI tools
and the restcache · streams · sdk
One binaryafter go build
the-protobuf-project.org15 / 25
The ecosystemThe Protobuf Project

Twelve projects, one schema

The ecosystem.One model underneath.

book.protoprotokit IRprotoc-gen-*
store
Persistence, from the resourcePostgres DDL · Prisma · GORM · repositories · filters
service
The AIP service layerstandard methods, hooks, errors, change feeds
http
REST that cannot driftHTTP/JSON gateway from google.api.http, with its OpenAPI
mcp
Your API, ready for AIMCP servers, tool schemas from buf.validate
cacheValkey
Read-through, invisible to callerstyped caches over Redis · Valkey · memcached
streams
Every RPC is already a streampublish · consume over Kafka · NATS · MQTT
buffersFlatBuffers
One schema, every wire formatFlatBuffers · Cap’n Proto · Thrift · ROS 2 · Wire
sdk
An SDK repository per languageclient, docs, tests and CI per language
openapi
Docs from the schemaOpenAPI v3, Markdown with Mermaid diagrams
web3
One schema, every chainSolidity · Solana Anchor · Hyperledger Fabric chaincode
telemetry
One framework, every signalLogs · metrics · traces · profiles on OpenTelemetry
runtime
Underneath all of itone interface per job, a driver per backend
the-protobuf-project.org16 / 25
The service layerThe Protobuf Project

protoc-gen-service

CRUD, done properly,written for you.

Recognised by name and shape alone. You write only the rule your business has.

GetAIP-131
name shape, NOT_FOUND naming the resource
ListAIP-132
page_size · page_token · filter · order_by · read_mask
CreateAIP-133
id rules, REQUIRED checked, OUTPUT_ONLY cleared, validate_only
UpdateAIP-134
update_mask, IMMUTABLE fields, etag concurrency, allow_missing
DeleteAIP-135
etag, soft delete when the resource has delete_time
UndeleteAIP-164
etag, validate_only, ALREADY_EXISTS when live
hooks.go · yours, adapted from the README
type bookHooks struct {
shopv1svc.NopBooksHooks // the rest: no-ops
authors shop.AuthorRepository
}
// A book's author must exist.
func (h bookHooks) ValidateBook(
ctx context.Context, _ servicex.Op,
b *shopv1.Book, paths []string,
) error {
if !servicex.Touches(paths, "author") {
return nil
}
_, err := h.authors.Get(ctx, b.GetAuthor())
return servicex.NotFoundAs(err,
"shop.example.com/Author", b.GetAuthor())
}
Go and Rusterrors from proto (AIP-193)CloudEvents feeds
the-protobuf-project.org17 / 25
One port, every callerThe Protobuf Project

runtime-go · runtime-rs

Four protocols.One port. One codepath.

BrowserREST · JSON
A servicegRPC · proto
An LLMMCP tool call
An agentA2A task
in front · yoursGatewayEnvoy, load balancer
A2A:8080 · hybrid serverOne portgRPC · REST · MCP · A2A, with TLS, CORS, validation, idempotency and graceful shutdown.
Generated servers + your hooksprotoc-gen-service
Store repositoriesprotoc-gen-store
Read-through cacheprotoc-gen-cache
Valkey
A driver per backendswap with one line
the-protobuf-project.org18 / 25
One request, every layerThe Protobuf Project

One request, every layer

Follow one CreateBook.

yoursgeneratedruntime
ClientREST, gRPC or MCP
Hybrid server:8080
Interceptorsauth · idempotency
protovalidatebuf.validate rules
AIP checksid · REQUIRED · etag
Your hookBeforeCreate
Repositoryprotoc-gen-store
Postgresone transaction
Change feedCloudEvents
Kafka · NATSprotoc-gen-streams

Nine hops. One of them is code you wrote.

the-protobuf-project.org19 / 25
Swap it, or add oneThe Protobuf Project

Same request, another database

Swap it. Or add one.

Your hook and the generated code talk to one interface, never to a database.

swapObserve
Your hooknever changes
Repositoryprotoc-gen-store
database.DBruntime-go
Postgrestoday
MongoDBswap: one line
ArangoDBadd: a second store
main.go · swap
// before: Postgres, through GORM
p := orm.NewProvider(gormDB)
// after: MongoDB, the only lines that change
client, _ := mongodb.NewClient(ctx, cfg)
p := mongodb.NewProvider(client)
hooks.go · add, illustrative
// a second store: one more hook
func (h bookHooks) AfterCreate(
ctx context.Context, b *shopv1.Book) error {
return h.graph.Create(ctx, b) // ArangoDB
}

A second store is a consistency choice: when its write fails, you retry, queue it, or reconcile from the change feed. The hook is where that choice lives; it is not free.

the-protobuf-project.org20 / 25
The whole applicationThe Protobuf Project

protoc-gen-service app=shop

What’s left isyour business logic.

generated
  • configrelease + dev profiles, env overrides, validated
  • telemetryOTLP pipeline, logging, meters
  • databasepooled Postgres, error translation, cache provider
  • serverevery repository, every server, interceptors, idempotency
  • hybridTLS, CORS, MCP, graceful shutdown
  • backgroundwebhook delivery, soft-delete purger, pool monitor
  • errors.mdevery package’s error reference
yours: the whole of it
cmd/shop/main.go · adapted from the README
func provision(d *server.Deps) (server.Provision, error) {
return server.Provision{
// around the standard methods
Hooks: server.Hooks{Books: bookHooks{d.Repos}},
// the hybrid server
Options: []grpc.Option{grpc.WithUnaryInterceptors(auth)},
}, nil
}
func main() { app.Main(app.Options{Provider: provision}) }
terminal
$ buf generate # store, service, http, mcp, cache…
$ go run ./cmd/shop # gRPC + REST + MCP on :8080
the-protobuf-project.org21 / 25
A real application · FreebusyThe Protobuf Project

Case study · Freebusy

An application builtaround the contract.

Availability and booking for courts, rooms and equipment. The application owns the booking rules.

01

Search

02

Hold

03

Settle elsewhere

04

Reserve

generated from protobuf

Repositories and service scaffolding

Models, filters, database access and standard API methods.

application + database

Booking rules and invariants

Availability, allocation and hold lifecycles. Postgres prevents overlapping claims.

gRPC · REST · MCP · CalDAV · Postgres · github.com/shokki-engineering/freebusy

the-protobuf-project.org22 / 25
Freebusy · published measurementsThe Protobuf Project

Freebusy 1.0.0-rc.1 · repository-reported results

Booking throughput,latency and correctness.

226complete booking flows / secondcited16 clients · search, hold, reserve, read
12,581get/list read requests / secondcited64 clients · list cache hits: 100%
0double bookings in the contention runcited64 clients · 600 windows · each won once
booking flow latency

70 / 120 ms

p50 / p99 for the whole flow

read request latency

4.4 / 14.8 ms

p50 / p99 with cache enabled

contention traffic

1,882 requests/s

Includes competing attempts

One shared M3 Max laptop · two application replicas · Postgres + Redis + k6 on kind

10,001 resources · most concurrent runs: 40 seconds · separate workloads, not a capacity guarantee

Source: Freebusy README · Performance · d2b9d0f

the-protobuf-project.org23 / 25
Where it goesThe Protobuf Project

Schema first, all the way

Write it. Generate it.Ship it whenever.

1Write the schema

One .proto with AIP annotations. Lint it in the editor as you type.

2Generate natively

Go, Rust, TypeScript, SQL: real code in your language, byte-identical on rerun.

3Compile

Typed end to end. Rename or remove a field and every generated client that uses it stops compiling.

4Deploy whenever

One binary, one port. Swap a backend with a line of wiring.

bring a GraphQL API

idl2proto rebuilds its .proto contract

bring an OpenAPI spec

gnostic converts it to protobuf

try it now, nothing to install

the-protobuf-project.org/editor runs the real plugins

the-protobuf-project.org24 / 25
QuestionsThe Protobuf Project

Thank you

Write it once.Questions?

the site and editorthe-protobuf-project.org
the code, Apache-2.0github.com/the-protobuf-project
installbrew install the-protobuf-project/tap/protoc-gen-service
who I am · BengaluruSrikanth K

I work on seams: the places where two systems have to agree on something, and don’t.

oh-tarnished.devgithub.com/oh-tarnishedlinkedin.com/in/srikanthkandarpx.com/srikanthkandarp
the-protobuf-project.org25 / 25
01 / 25 · Cover Open source talk