DEV Community

Cover image for COVID19 Summary gRPC API written in Typescript
Anzhari Purnomo
Anzhari Purnomo

Posted on

COVID19 Summary gRPC API written in Typescript

This is a gRPC API sample implementation on Node.JS written with Typescript.

You can check my sample code here: https://github.com/anzharip/covid19-id-grpc. Live demo on: 52.148.115.205:10080

You can access the live demo with any gRPC client or for GUI client, you can use BloomRPC:
Screen Shot 2020-09-26 at 15 03 59

The live demo is hosted on Azure Container service with 1 vCPU and 0.5 GB RAM. I benchmarked the service and it is running quite fast serving ~500 request per second without any optimization:
Screen Shot 2020-09-26 at 15 01 39

The datasets are retrieved from https://covid19api.com.

Notes:

  • You will need to compile the .proto files into Typescript definitions to create gRPC API in Typescript. You can follow the steps to do that here and here.

Top comments (3)

Collapse
 
starpebble profile image
starpebble

I'm interested in gRPC. Please kindly go into a sentence or two more why you select gRPC when building an example coronavirus product!

Collapse
 
anzhari profile image
Anzhari Purnomo

Hi Starpebble, thanks for starting the discussion!

So the background motivation for the gRPC was because I was trying to prepare for an upcoming project and want to know the tooling and quirks of gRPC.

Recently I am working on a multiplayer VR game project, and I need to build some kind of backend for the game. Considering we need to keep the latency and overhead low for the backend, I look for other alternative aside from REST.

I remembered that lately I saw a lot of backend project and job opening were mentioning gRPC. And realized that the low latency and and low overhead nature of gRPC might be the things that I need:

gRPC is roughly 7 times faster than REST when receiving data & roughly 10 times faster than REST when sending data for this specific payload. This is mainly due to the tight packing of the Protocol Buffers and the use of HTTP/2 by gRPC.

Hence, I'm trying to look for it's feasibility for my project.

How about you, have you tried gRPC yourself?

(It's definitely more than one and two sentences for you, but well... I am happy if I could help you 👍👍👍)

Collapse
 
starpebble profile image
starpebble

I don't disagree. A little feedback: the cloud native computing foundation is incubating gRPC on grpc.io. Which simply is another way of saying it's going to be all over the place.