Before developing, we first need to finalize the web framework that should be used. Go has a number of frameworks that are production-ready. This post considers a few of them before deciding on one.
We've designed our database model and we're ready to complete our pre-development!
Now that we have all the prerequisites in place, including our user flows, database design and API specification, it’s time to start development.
There's one final decision that needs to be made. What’s our web framework for development going to be?
For Java developers there's Spring Boot; Python developers will opt for Django, and NodeJS developers, will likely choose Express. Similarly, when writing services in Go, there are an array of frameworks that are available in the market.
We considered all our options (below) and decided on Echo. Here’s why.
Rich feature list
"High performance, extensible, minimalist Go web framework" that is who Echo describes itself and they aren’t lying.
The framework offers a ton of features, including but not limited to:
- Web Socket support,
- Authentication methods like JWT, Basic Auth, etc.,
- Automatic TLS, and
- Template Rendering.
Interestingly, Echo also supports HTTP2 and the middleware can even generate metrics for Prometheus (a popular metric monitoring tool).
Speed and performance benchmarking:
Active development and community support
In early 2021 (when this blog was written), Echo's GitHub repository looked quite busy. The development pace was rapid and releases were frequent. Moreover, the number of stars (19k), forks, and good documentation bolstered our decision.
Finally we chose Echo because of the effortless learning curve. The syntax was easy to use and Go recognised it fast. Of course, this last point is subjective, which is why we have a whole list of excellent options for you to consider.
Fiber is an Express inspired framework. If you’re a NodeJS developer accustomed to developing in ExpressJS and looking to cross over to Go, this framework will make it significantly easier for you to adapt. Honestly, we had to go back and forth between Fiber and Echo before we came to any decision.
Gin-Gonic is a well known web services framework in Go. The framework was built based on Martini (no longer maintained now). It managed to increase the speed by almost 40x. Gin is very minimalistic and well documented making it easy to learn and develop within it (given its popularity, Gin was a strong contender for us).
There is one downside: it doesn’t do well with large scale applications. A lot of external plugins may be required when implementing numerous features on the server.
Buffalo is inspired by Ruby on Rails and comes with a lot of nifty features including a reload tool which watches all ".go" files and reloads the application live. It also has a CLI based project scaffolding that generates code templates.
Gorilla is probably of the oldest and most well known frameworks in Go. Maybe that’s why most tutorials on the internet use Gorilla. Its' design is modular, scalable and supports websockets. It is definitely a well-loved framework. However, when compared to other solutions, Gorilla lacks in performance and requires more effort in configuration for using the modules.
Yay! You've reached the end of our Microservices I: Pre-development Series. Now it's time to move on to Part II, ready?
Join the conversation