Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

real life files structure #14

Open
ashkank83 opened this issue Sep 14, 2020 · 3 comments
Open

real life files structure #14

ashkank83 opened this issue Sep 14, 2020 · 3 comments

Comments

@ashkank83
Copy link

Hi,
Thanks for the great work maintaining and adding features to this repo.

How do you recommend to structure a real life set of micro services using kit?

Every time I generate a new service it will create a new pkg and cmd folder, however it looks like the best practice for a real project is to have one pkg and cmd and then a folder for each service (under cmd and pkg) as well as other folders for other shared packages. (https://github.com/peterbourgon/gattaca)
Am I doing something wrong whilst generating my services hence getting the wrong folder structure?
Would be great help if you know of any tutorial/instruction showing how to use kit for creating at least two services with both gRPC and html transport and ideally clean architecture (I searched a lot but couldn't find anything!)

Thanks

@GrantZheng
Copy link
Owner

Hi,
Thanks for the great work maintaining and adding features to this repo.

How do you recommend to structure a real life set of micro services using kit?

Every time I generate a new service it will create a new pkg and cmd folder, however it looks like the best practice for a real project is to have one pkg and cmd and then a folder for each service (under cmd and pkg) as well as other folders for other shared packages. (https://github.com/peterbourgon/gattaca)
Am I doing something wrong whilst generating my services hence getting the wrong folder structure?
Would be great help if you know of any tutorial/instruction showing how to use kit for creating at least two services with both gRPC and html transport and ideally clean architecture (I searched a lot but couldn't find anything!)

Thanks

Hi, I think the case (https://github.com/peterbourgon/gattaca) is not a best practice for creating at least two services.
You could realize a monolithic architecture that contains several services as follows:
(1) mdkir appbackend
(2) cd appbackend
(3) kit n s dna
(4) kit n s auth
image

@ashkank83
Copy link
Author

Hi @GrantZheng ,
Thanks for the answer. Following the above architecture:

  1. Where will we have the shared packages (shared logic, etc. )? (I see there are two go.mod files created for each service so not sure where to have shared pkgs?)
  2. This is really specific case of the first question: our services will be calling each other via gRPC, what's the best practice to share types between services (to have data validated)

@GrantZheng
Copy link
Owner

Hi @GrantZheng ,
Thanks for the answer. Following the above architecture:

  1. Where will we have the shared packages (shared logic, etc. )? (I see there are two go.mod files created for each service so not sure where to have shared pkgs?)
  2. This is really specific case of the first question: our services will be calling each other via gRPC, what's the best practice to share types between services (to have data validated)

Hi, I am sorry! A little busy some time ago, I didn't reply you in time.
If you want to have the shared packages (shared logic, etc. ) between each service, you could create a common library that can be refered in other projects and managed by gomod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants