How do I share Protocol Buffer .proto files between multiple repositories


We are considering using Protocol Buffers for communicating between a python & a node.js service that each live in their own repos.

Since the .proto files must be accessible to both repos, how should we share the .proto files?

We are currently considering:

  1. Creating a repo for all our .proto files, and making it a git subtree of all our services
  2. Creating a repo for all our .proto files, publishing both a private python module and private node module on push, and requiring the modules from the respective services
  3. Creating a repo for all our .proto files, and specifying the repository as the destination of a pip / npm package

What is the standard way to share .proto files between repositories?

Asked By: Swaraj



This depends on your development process.

A git subtree / submodule seems like a sensible solution for most purposes. If you had more downstream projects, publishing a ready-made module would make sense, as then the protobuf generator wouldn’t be needed for every project.

Answered By: jpa

We, in the same situation, used 3 repos: server-side was written in c++, client-side in actionscript 3, and protobufs was in the third, and was used both of them. For a big team, and big project I think it was a good choice.

Answered By: Dmitry Malugin