Do you also use PB schemas for XHR?
Motiejus Jakštys

Yes, we serialize as JSON over the wire instead of protobuf’s native binary format. This design-decision emphasizes human-readability and has served us well.

Protocol buffers provide an IDL, serialization format, and can generate code implementing this system in a variety of languages. We make extensive use of the IDL for data structures, but use JSON for serialization and our own open-sourced pbnj code generator.

Using the protobuf IDL, we define data structures (e.g.: User, Post) modeling our DynamoDb/RDS storage layer and models exposed in our API. We then generate:

  • Objective-C for our iOS app
  • Simplified Java for our Android app
  • JavaScript for our Node.js web client & server
  • Java for our JVM-based analytics infrastructure

This ensures all parts of our distributed system use the same data structures. Additionally, we follow the protobuf schema evolution rules, allowing apps with various release cycles to remain compatible.