DEV Community

Cover image for Action Protocol, abstract layer to help create your microservice.
Julio Contreras
Julio Contreras

Posted on

Action Protocol, abstract layer to help create your microservice.

Hello world! I've been a programmer for over ten years in different technologies.

This year I started making my own microservices and found many interesting things like DDD architecture, gRPC protocols and metrics systems.

In the middle of development I came across a question. How use HTTP or gRPC without change my application?

It was when I had the idea to create an abstraction layer, where I pass the action, data and authorization token.

This also allows to control the time and quantity of general requests or by type of action.

Image description

Example data:

{
  "action": "createCar",
  "data": {
    "brand": "Ferrary",
    "color": "red"
  },
  "token": "mytokensecret" 
}
Enter fullscreen mode Exit fullscreen mode

Repository:
https://www.npmjs.com/package/action-grpc

Example project using action-grpc:

  • src/infrastructure/http/http.ts
  • src/infrastructure/grpc/grpc.ts

https://github.com/julioacontreras/authenticator-storage

ThankΒ΄s and good vibes!
Bye

Top comments (0)