From Zero To Microservice [1]

How to Design API, Server & Client With Ease?

Yamac Eren Ay
6 min readJan 6

--

Previous article:

Next article:

What is gRPC (Again)?

Fig 1: A Cloud-Native application using gRPC for communication, Source: https://learn.microsoft.com/de-de/dotnet/architecture/cloud-native/grpc

gRPC is a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. [1]

It lets you:

define the service interface and the structure of the payload messages using Protobuf (Protocol Buffers) in a Protobuf file named e.g. <service>.proto, then

generate the server and client stubs automatically using <service>.proto in a variety of languages and platforms, but also

integrate bi-directional streaming and authentication features of HTTP/2

Planning

Fig 2: A DB consisting of key-value pairs, Source: https://www.scylladb.com/glossary/key-value-database/

Let’s start with the following user story:

As an end user, I want to perform read/write operations on person data.

So we want to design a microservice which looks up person by a selected identifier and/or updates person data.

I choose Go as the programming language due to its simplicity and high speed.

Instead of creating HTTP server / client from scratch, I prefer to use gRPC for code generation.

Setup

Setup folder structure (I named it person):

Fig 3: Folder structure

--

--

Yamac Eren Ay

I love to write articles about the most underrated topics in computer science