My template for projects in 2023 using Go (Fiber and MongoDB) 👨🏽💻

Do you Speak Spanish? Visit Spanish version in my blog
We are already close to the end of 2022 and this means it is one more year in which I work as a Golang developer full time, within this year of work I discovered new tools that help you in the development flow and documentation as well as a new way to organize my projects in a way that they scale in a healthy way.
The Stack 🧱
We will make a mini tour of the tools that bring this template to life and we will know why I currently use them.
- The Router🚀: For the router I chose to use Fiber due to the multiple tools that it has developed internally in the framework and because it seems to me that the declaration of routes is much more intuitive.
- The Database 💾: For data storage I chose MongoDB because of its easy deployment and above all because most of the projects I developed in 2022 and 2021 asked me to use this database.
- The Documentation 📄: One of the most important parts when you develop a project in the professional field is the documentation, remember that you will work with more developers. For this we will use Swag a Go package that allows us to generate documentation based on comments.
- The Logs ⚡️: Regarding the logs, it is a combination between a tool developed in the project that allows me to have logs in a CSV file and for the Logs on the server I use Zap.
- The Tests 💀: In the tests I used the native Go library in combination with the gomock mock library to automatically generate mocks from my interfaces.
- The Containers 🐳: For the deployment in containers for now I’m still using Docker, I’m exploring new options, if you have any recommendations leave it in the comments.
- The Deployment 🐙: For the CI I am totally in love with Github actions and its potential, I opted for Github Actions for the ease of integration with your repository.
The file structure 📂
We have a combination between the famous “Go Standard Layout” repository which is an unofficial “Standard” and the package structure comes from the Hexagonal Architecture folder structure.
Inside the packages we can see inside the internal/user folder that we have 3 folders application, domain and infrastructure. To keep the functionalities as easy to understand as possible I have separate files for each of the functionalities .
Leave this project as a template on Github in case you want to see it in more detail and as an example, implement the entire login and authentication system using JWT.

Conclusions 🤔
Every year you improve as a developer exponentially if you are constantly starting new projects, it helps you think: What would you have done differently when you started this project? What tool would you have used instead of this other one? and applying them you iterate little by little until you find your perfect “template” to start a project. For now this is mine and I hope it will help you so you can create your own according to your needs.