How should be designed the ideal Golang CRUD backend ?

About framework and libraries

We all know it, frameworks have important drawbacks. When you use a framework, you learn the framework, you don’t learn the language.

Protobuf-based core structures

Protobuf is a mechanism to easily serialize data from a struct, which we will see is incredibly important, especially for transferring data.

GraphQL gateway

I’m a firm believer of GraphQL for the public part of your API. I won’t describe here the added value of GraphQL compared to REST, you can find plenty of them on the Internet, but let’s just say that you can request plenty of data in a single request, API versioning is easier, and you only get and compute what you ask for.
This type of API make the work far easier to do for the client developers, they just have to request the data they want, and also avoid a lot of useless computation on the server side.

Event-driven architecture

This is where things start moving out of what we know from our monolith framework. In a microservice architecture, you have to make sure data and events are consistent with each service, and this may be really hard to do well since we don’t have the reliability of database transactions anymore.

Cache, back in local memory ?

Using all these new concepts may provide some great opportunities. Please note on this part is only a theory, I may be completely wrong, but it’s a good illustration of what could become possible when you combine the best concepts around.

Conclusion

A prototype already exists, and is published on Gitlab: https://gitlab.com/empowerlab/example. Look at it for more information. All open-source, Apache license, but no company behind, just some lonely exploration from me.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
YannickB

YannickB

19 Followers

French developer, backend/ERP software. Opensource advocate and passionate, always learning. http://empower.sh