11
votes

Since you have to share .proto files to define data and services for gRPC, service provider and clients need to access the same .proto files. Is there any common strategy to distribute these files? I want to avoid that every project has its own .proto file in its Git repository and our team members need to manual edit these files or share them via email.

Is there any common best practice?

1
Not sure about the common best practices, how my company has done this in the past is, have a central repository host all (most) proto files as well as the generated code. Usually projects in GoLang or Node.JS simply pull the latest version on build or people try to pull the latest release of the proto definitions for their projects. Whenever a new proto change is made to master, the CI generates a release with generated code.ishaan
You might also consider sharing your .proto files using git submodules.Richard Belleville

1 Answers

6
votes

Unfortunately, there is no common practice, although the main goal that you should achieve is to store proto files in one version control repository.

During my investigation, I've found some interesting blog posts about that subject:

They covers much of gRPC workflow considerations. Hope that helps!