Skip to content

Project Structure best practices with multiple services #391

Closed
@tfmertz

Description

@tfmertz

We have a large application that has 9 different gRPC services and we are currently trying to transfer them into a micro services architecture. Before, all of these proto files were in a single proto/ directory:

service/
  proto/
    foo.proto
    foo.pb.go
    bar.proto
    bar.pb.go
...

Now, we are splitting each service out to run in its own kubernetes pod:

services/
  foo/
    proto/
      foo.proto
      foo.pb.go
  bar/
    proto/
      bar.proto
      bar.pb.go
...

We are running into issues where our foo service returns a message that bundles a message from the bar service, but the foo service knows nothing about any of the bar service's messages.

I have tried importing a bar_shared.proto into the foo.proto file to give it the required message but namespacing issues abound. I have run into issue #67. This makes me think that I'm using the wrong approach.

I wanted to get a reality check on our structure, and if there is a better way to accomplish what we are attempting to do. Should we create a master proto/ folder like before and have everything in the same namespace and include all the compiled pb files in each service?

Or is it bad practice to include the bar service messages inside of a foo service message?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions