Transitioning application packages to library #13
-
Hi @benbjohnson Follow up questions after reading https://www.gobeyond.dev/packages-as-layers/
Appreciate your articles and this repo! They have shed much light to a beginner golang dev. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @Jiraffe7, thanks for the question. I think it's tough to say without seeing a concrete example. In that situation, I find there's usually one of two things happening:
If you're in situation number 2 then you have a couple options. You could combine the microservices into one application. You could continue to have separate repositories for both microservices and they depend on a third repository for the common domain types. You could also combine into a monorepo and have subdomain packages for each application. For example:
This option is good when you have a lot of services and you want to treat them as independent applications. Each one can be isolated and even have their own |
Beta Was this translation helpful? Give feedback.
Hi @Jiraffe7, thanks for the question. I think it's tough to say without seeing a concrete example.
In that situation, I find there's usually one of two things happening:
Your extracted library is more generic than your application domain so it probably should be a library. An example would be if you had a file format encoder/decoder in your application that other applications would benefit from using. In that situation, it makes sense that your application would depend on the library so I don't think you need to invert the dependency.
Your extracted library is being shared by two applications that share the same application domain. I find this happens in microservice applications a l…