Can you build a web application in Go?
Surely the answer is yes. Any yet, a surprising number of people asked me this question. Something must have prevented them from writing web project in Go.
So, I began the journey…
Superficially, Go culture is similar to Node and Python in the web world.
Everyone is suggesting newcomers to start small, gather the components one by one as you need them. Seems reasonable.
So that begs the question, what are the minimum features you need to build a modern web application?
Here’s the non-exhaustive list:
A database, usually RDBMS but not always.
Database migration tool, some web frameworks provide it, some don’t.
Logging facility, all modern languages provide this.
Testing tools, most modern languages provide this.
HTTP router, usually comes by default if you use a web framework.
HTTP middleware, some web frameworks provide this by default.
Session, context, and cookie management, fairly standard stuff.
Password hasher, you cannot have a web project without it.
Healthy amount of 3rd party libraries to build awesome things.
That’s… quite a lot of stuff and professional work usually comes with a deadline attached. I can see how this may presents a barrier to new users.
At this stage most newcomers would start googling “Golang Web Framework”. And boy, do they have a lot of choices:
This reminded me of the bad old days of Python web frameworks before Django came along: Zope, Twisted, CherryPy, TurboGear, Spyce, Quixote, web.py, etc.
By now, probably half of the newcomers who are interested bounced already and return to their comfort zone: Rails or Django.
That said, the high number of web frameworks is not the biggest problem. Instead, it’s the difficulty to bootstrap a new project within a deadline.
From 0-60, how fast can I get a new project up and running while still following the community’s general advice; by starting small.
If a newcomer decides to use one of the larger frameworks, the community will tell them to use smaller ones or even just net/http.
But realistically, a big web project needs a structure. A common set of tools or conventions for engineers to maximize their agility at work.
So what if, you can have a cake and eat it too? What if, you can have all the things you need for a modern web application without being forced to adhere to a big framework.
A project generator can do that for you. It removes the analysis-paralysis situation during the research phase and provides users with the ultimate freedom to use or remove some of the components.
To test this idea, I created go-bootstrap.
It puts together common tools (following the requirements described above) and bootstrap a new project to the point where user can signup and login.
Once a project is generated, users have 100% control over the web stack. There’s no need to worry about upgrade headache from version 2.0 to 3.0.