Would love to get feedback on my first attempt at go with this api boilerplate. It aims to be easily extendable and follow idiomatic go and best practices.
Therefore I would like to be pointed to mistakes I made and general suggestions on improving the application structure and functionality.
Thanks in advance - every comment is highly appreciated.
Thanks for looking! I tried to assemble a sensible but minimal set of features common to most web application apis. Documentation will be improved when I am more confident about the application structure and features. So far everything exported is commented so godoc gives an overall overview. Also added an overview of the api routes to the repo readme just now. Is there anything specific you think needs documentation?
In general this boilerplate is not so much about features but about an extendable and maintainable application structure.
No, nothing in particular, it’s only that when I read the API docs at godocs.org I thought that maybe some brief intro or examples for using the packages wouldn’t go astray.
I recommend that you organize your packages by your app’s features instead of components like api, auth, database.
As I see, in this version of your app, there’s only one feature right now: profile. It’s being injected into api, database, and models. What I’m suggesting is that there would be a profile package which would contain its own api, database and models sub-packages.
In this way, your project will be more modular and will more act like a library instead of an app. You can then bind the necessary components using that library to your app.
Thank you for your reply. I totally agree that a more domain driven approach makes sense here and I will do some refactoring in this direction. Need to figure out how I can make the auth library more pluggable with the account model and still be extendable somehow.