architecturenestjsmicroserviceskong

Client / API Gateway communication for a GRPC


It's my first time trying to make a microservice architecture and I don't understand how works communication between client -> api gw -> microservices if I use GRPC communication.

To make it clear:

  • i'm using kong as my api gateway
  • my microservices are created with NestJS with GRPC communication (built with nestjs/microservice package)
  • and I have a React client

The thing is I would like to know if we can make an HTTP call from the client to the API Gateway and then the API Gateway will "translate" this HTTP call to a GRPC request and then send it to the corresponding microservice.
Same for the response (microservice -> api gw -> client).

It that even possible?
Or should the client makes GRPC request to the API Gateway (seems weird!!)
Is it the same problem with TCP or UDP communication ?


Solution

  • Kong has a plugin for that : https://docs.konghq.com/hub/kong-inc/grpc-gateway/

    Your application will make HTTP calls to Kong, and Kong will translate the HTTP calls into gRPC calls to your service.

    Kong does not handle native gRPC requests from the application, it has to be HTTP requests.