Go application layering
Several months ago I built a web service in go which, inspired by the blog post "Packages as layers, not groups", I made strictly layered. Not to make a rule out of it and not saying that this is what packages are, I think using packages as layers for different building blocks of an application (RPC, business logic, storage, cache, auth, etc) helps a lot in structuring an application. There was another blog post that talked about using separate structs for the same model (or data transfer object) in each microservice or layer, as opposed to re-using the same struct from a single library and so introducing a dependency everywhere. I cannot find it any more but I loved the idea and I used it in my app as well. I wanted to put these two ideas out there and so I changed all the code from the original app and made it a dumb key-value storage REST API. The project is on GitHub: https://github.com/varfrog/layers. Comments are welcome!
Comments
Post a Comment