I have been encouraging every programmer to have this language into his / her toolbox. Alright, some projects where Golang have been rocking :
1/ I have been passionate about building my own multi-room chat platform. Golang helped build “ConfChat”.
I can use that chat platform to push message and interact with anyone having the client program. This is one of the real examples of networking programming. I took time to design the client application, initially console-based, and the server-side program. It has been a great journey, since you will have to think on security aspects like authentication, authorization, encryption with custom self-signed certificate approach etc. You will need to implement reconnection techniques and per room state saving. Handling room ownership and permissions of each participant is very important aspects as well. The architecture I used is a client and server. A moderator (who is the owner of a room) can disconnect someone, closed the room and more. There is a possibility for a participant to send a private message – unicast messaging. All these features were implemented on the backend side – which involve advance manipulation of raw TCP sockets and channels and goroutines. I used MongoDB for saving room ID and password and Moderator ID. Of course, each room as a lifetime since I used MongoDB built-in feature for automatic cleanup. I decided to not save participants messages on disk, there is nothing saved on backend side like chat messages. Every participant in each chat room can export their own ongoing discussion. Just 2.5K SLOC of Golang done right for the backend. On the client side – I designed and built the Android apps with pure Java, and console-based with Python. I started building the Desktop-based version with WxPython. Below is the direct link to grab and play with the Android apps – you will love it for sure. Added some old demo videos.
2/ Another one named “Cisco Skills Challenger” – I had with Golang. I have always been reached by mostly new engineers for help in understanding some networking concepts and some way to keep learning. To avoid repeating effort to help each person, I decided to build a networked platform that will deliver Quiz based on the user settings like level, topics and language (English or French). For future scaling, I decided to go for a Rest APIs architecture. I used Golang to implement a secure APIs with HTTPS and JWT (Json Web Token). This APIs backend is very light – since I need high performance, I did not use any database for storing data, rather all Quizzes are loaded at startup time into a structured memory and there is a possibility to add more Quizzes while the backend is running. Just around 1K SLOC were enough to bring it up. There is an Android apps for consuming those APIs and a console-based client written into Python. Below is the link to get the Android apps and start playing at the Quiz with ease.
I did not stop there regarding the Cisco Skills Challenge product. With the high adoption of the Android client, more people were requesting browser-based version. To make it more interesting, I decided to write a dedicated Rest APIs backend into Golang (as always) for the browser-based clients. I have chosen to go for passwordless architecture which means I implemented custom encryption and authentication mechanism to make sure the backend is serving the right person based on the auto-generated credentials provided. You just need to provide any username and a valid email address to receive access credentials (valid for one week) by email and a custom unique login link. Most of the technique used are based on encrypted cookies and chained middlewares with JWT. I found useful to implement rate limiting. Gorilla and Alice and Logrus and JWT-Go were all great at building this amazing backend APIs. Just 2K SLOC were enough to craft this backend (only pure Go code). The frontend code is reactive and built with VueJs. Below is the link to play with the platform.
3/ I built from scratch my blog into Golang. The interesting thing into building a blog – is the design aspect. You need to think about security from the beginning since you should not allow a visitors get privileged access. You must carefully design your backend to deal with that – don’t trust something coming from browsers side, feel free to double check and sanitize before moving further into the processing pipeline. This is valid for forms submissions as well. Another aspect is your dashboard features – at least you need to be able to create – display – edit – delete – enable – disable – view stats of any article. You can go further by implementing categories and tags and numbers of views and numbers of likes, with filtering capabilities per categories or per tags, as I did for my blog. This means you should craft very well your article json object (structure) since the beginning. I persisted my data into MongoDB. Just 3K SLOC (without HTML templates) were enough to bring to live my blog. Here is the link
4/ At Poland, as a normal Gopher, I searched for and joined the Golang community here named GoCraCow. I got the opportunity to present a topic on Golang. Since, there was a need to help beginners get motivated and started at Gophing, I titled my talk as “Become A Doer With Golang”. For live demonstration, I decided to present a highly concurrent tool I was building for my day-to-day work which involved navigating into millions of lines of logs and providing root cause of incidents - as a support engineer. The tool uses goroutines and channels and workers pool to speed up the processing of thousands of logs files. It is a console-based, and you have a menu of dozens of options – which are divided into searching – sorting – displaying etc. Just 2.5K SLOC were enough to build this log processing tool. Below is the link to the slides used for the talk and a demo video.
click to view the talk slides
5/ Another great tool build with Golang. It was a management platform for all my backend services from a console-based client. The idea was to have a light tool which can connect to a specific backend which in turn will interact with the database for fetching information or interact with other backend services for pulling their states and be able to start, restart or shut them down. I used a raw TCP based socket to implement my own commands and goroutines to process incoming request separately – I call it socket-based APIs backend. Just 2.5K SLOC were enough to craft this server. This is an internal tool for my services – so I did not release any public link or demo for that toy. Another private project – was done into one of my previous Jobs. There was a need to build a secure backend Rest APIs which will be consumed by AngularJS-based reactive frontend. I have chosen Golang to spin up that backend into one night – Just a CRUD for manipulating internal employees directories. The elegancy and the speed of the backend were very impressive – which motivated even frontend engineers to start learning Go for backend development. Just 500 SLOC were enough to bring up this service. Another private project done into my current company – which is a volunteering exciting project. I added my inputs by helping rethink the system. It is a platform that will server hundreds of thousands of people, and I pushed the mindset to think about future scaling earlier. I introduced Golang and helped the team by designing the Rest APIs backend which persists into MongoDB. I built the foundations with 3.5K SLOC to implement the APIs backend. Right now, this great project still ongoing and help by another volunteers.
6/ I will finish with this beauty I have been building with Golang. As mentioned before, I am always getting requests from people (from current companies, students, from social media) to help them get into coding or automation or debugging their programs. I like sharing and helping others grow – this is how they can make the community grow and giving back. However, doing it per person basis is not efficient, so I decided to design and build from scratch an online learning platform where I can offload my knowledge by writing articles based on my real personal experience and making videos for people to learn. Besides, I implemented some options to publish my upcoming books and softwares I built. It is a very rich platform, and I cannot even remember all the features I implemented since there are a lot. From password recovery mechanism, to email broadcasting to account flapping to billing routines to automatic spam blocking to role-based access to granular level of subscriptions and many more features. I am seriously proud of this bilingual (English and French) learning platform. I decided to use a strict MVC approach. Right now, only (without the HTML templates) the Golang backend is at 15K SLOC. Here is the link to access –
I will conclude this article by mentioning that Golang is a great language and it really helped me to become a doer at scale. Right now, building backend into Golang is something very easy and fun for me – and I encourage everyone to give a try. Of course, I am still having many ongoing Golang projects – like combining the chat and the quiz to build a learning battle room, like porting into Golang – this monitoring tool I have recently prototyped with Python (see youtube link below), and crafting a networked game which will be played with family for fun and many more . . .