Skip to content

spachava753/go-kit-todo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-kit-todo

This is a simple example of a todo microservice using go-kit.

Thoughts

While Go-kit is great, it does have some drawbacks. Its very verbose, and has a high upfront cost for creating services. I wouldn't really suggest using the library for prototyping. Moving even further, in a containerized and cloud-native world, we don't need to concern ourselves with circuit-breaking, load-balancing, metrics, etc, since our platform can handle that. Of course, some things are still necessary like application logging and service level metrics, but things like circuit breaking and load-balancing is done by platforms like AWS or Kubernetes. Kubernetes inherently gives you service discovery and simple load-balancing, but taking things further with service meshes, we can utilize service to service encryption, reverse-proxying, circuit breaking, metrics, and distributing tracing. As such, in 2020, we don't need to concern ourselves with such matters.

Yet Go-kit introduces an interesting, but well-known concept of middleware. We would write our core business logic, and test it, and we then we can wrap our business logic with extra functionality like application logging. We can "append" functionality without actually modifying previous layer. This is a powerful concept, as we can separate functionality through layers, and gives the flexibility to enable and disable certain layers at start up, perhaps even during runtime.

Something that I really liked once all of my services were created and all boilerplate was finished, was the ease of which I was able to transition from using gorilla mux and net/http to using fiber. All I had to do was create new encoders and decoders, and a new function to wire up the handlers. The concept of encoders and decoders allows endpoints to simply function without worrying about how requests and responses will be translated. Encoders and decoders would contain environment-specific code while the rest of the code would stay completely the same. Insane!!!

About

A simple todo web service to experiment with go-kit

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages