New Readlist Application Backend: Golang instead of Python ⚡️

Date: 27.10.2020

A few month ago, I have built a Readlist Application to keep track of interesting reads. Back then I used Python with Flask to build the backend of the service.

However, recently I started learning the Go programming language. I then used the opportunity to rewrite the backend using Go with gqlgen.

Previous blog post:

Why did I rewrite the Python backend

As most tutorials for programming languages cover rather simple problems only, and I wanted to deepen my knowledge on Go, I was looking for a project that was more complex than a simple Hello Worldprogram.

The Readlist backend had to combine a GraphQL based webservice that also needed to connect with a MongoDB NoSQL-database.

This means the project had to deal with dependency management.

Reimplementing the backend using Go meant to go from an untyped, interpreted language to a strictly typed and compiled language. A compiled language has several advantages over an interpreted language:

Screenshot of the Docker image sizes

What did I learn while reimplementing the backend

  1. Python as an untyped language makes it faster to prototype: in Golang you have more overhead code due to datascructures that are required.
  2. Due to the typed language property of Go, static code analysis can help to identify bugs before running the program. It does not catch all issues, but provides more safety when accessing properties of value sbeing passed around.


Developing using Go was an interesting task. There was a steep learning curve to deal with Go Modules, using the Go MongoDB driver and to use GraphQL in a Go context. It took longer to write the code than the Python impementation mainly due to my previous knowledge on Python and the overhead because of having to define the required types.

The savings in the size of the Docker image are massive: -98%. These savings will make the launch of the Docker daemon faster. Additonally it help to reduce carbon-dioxide emissions: The savings for our service are marginal, but in a larger context of being more efficient with storage and compute resources, this can have a huge impact.

Another benefit is the reduced latency of the Readlist Application measured on client side: loading & rendering a full readlist takes ~150ms with the new Go backend. The Python backend was slower and took ~300ms.

I hope you find this comparison helpful. I found the project to rewrite the backend very helpful in getting more expose to Go. ✌️