kit
kit copied to clipboard
real life files structure
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, 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
Hi @GrantZheng , Thanks for the answer. Following the above architecture:
- 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?)
- 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 @GrantZheng , Thanks for the answer. Following the above architecture:
- 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?)
- 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.