Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hemicharly/api-gateway-grpc-microservice

API Gateway and gRPC microservices with NodeJs, Python and Golang
https://github.com/hemicharly/api-gateway-grpc-microservice

Last synced: 26 days ago
JSON representation

API Gateway and gRPC microservices with NodeJs, Python and Golang

Awesome Lists containing this project

README

        

## API Gateway and gRPC microservices

API Gateway with nodejs and microservices in gRPC with nodejs, python and golang. Examples for study purposes.



#### 1. Requirements Installation

* Install docker
* Install docker-compose
* Install Makefile

#### 2. Steps to run this project

##### 2.1. Start project in mode development

* Copy file `docker-compose.override.dist.yml` with name `docker-compose.override.yml`

* Configure the environments: `API_KEY` is optional to monitor with amplify nginx

* To create proto interfaces in the project gRPC microservices in nodejs and python, use the script `script/protoc.sh`

* To start project using docker use the commands

| COMMAND | DESCRIPTION |
| --- | --- |
| make dev | Execute all application in mode development |
| make dev-grpc-customers | Execute grpc-customers application in mode development |
| make dev-grpc-users | Execute grpc-users application in mode development |
| make dev-grpc-products | Execute grpc-products application in mode development |
| make dev-grpc-orders | Execute grpc-orders application in mode development |
| make dev-api-gateway-grcp | Execute api-gateway-grcp application in mode development |
| make prod-api-gateway-grcp | Execute api-gateway-grcp application in mode production |
| make lint-fix-api-gateway | Execute command `yarn lint:fix` in api gateway |
| make protoc-grpc-customers | Execute command `yarn protoc` to app-customers |
| make protoc-grpc-users | Execute command `yarn protoc` to app-users |
| make protoc-grpc-products | Execute command `script/protoc.sh` to app-products |
| make nginx-start HOST_NAME=NGINX-01 | Execute nginx-grpc application using hostname |





* note: if start project nodejs in mode `production` change the script `docker/nodejs/entrypoint-server.sh`

from `yarn dev` to ` yarn build && yarn start`


##### 2.2. Testing the API Gateway

* Access api gateway in `http://localhost:3005`

| METHOD | SERVICES |
| --- | --- |
| GET | /customers |
| GET | /customers/12385 |
| POST | /customers |
| PUT | /customers |
| DELETE | /customers/12385 |
| GET | /users |
| GET | /users/47 |
| POST | /users |
| PUT | /users |
| DELETE | /users/6 |
| POST | /users/login |
| GET | /products |
| GET | /products/3 |
| POST | /products |
| PUT | /products |
| DELETE | /products/5 |
| GET | /orders |
| POST | /orders |


##### 2.3. Testing the gRPC Microservices using BloomRPC

* To install BloomRPC access the [guide](https://github.com/uw-labs/bloomrpc)
* Access Microservice Customers gRPC in `127.0.0.1:50051`
* Access Microservice Users gRPC in `127.0.0.1:50052`
* Access Microservice Products gRPC in `127.0.0.1:50053`
* Access Microservice Orders gRPC in `127.0.0.1:50054`

##### 3. Reference

* What is gRPC [guide](https://grpc.io/docs/guides/)
* Nginx with gRPC [guide](https://www.nginx.com/blog/nginx-1-13-10-grpc/?utm_campaign=core&utm_medium=blog&utm_source=youtube&utm_content=grpc)
* What is Amplify Nginx [guide](https://amplify.nginx.com/docs/)