Ordering application with using grpc micro-services
- product-service: nestJS gRPC microservice to manage Product details (name, description, etc.)
- ordering-service: nestJS gRPC microservice to manage Order creation and completion
- api-gateway: Golang service using gorilla mux to act as a gateway for
product-service
andordering-service
These services are able to communicate with each other through RPC calls using the protobuf definitions defined in protos
folder.
The gateway implements a layer of JWT authentication and requires the client to pass in an authorization token in header while trying to access any of the exposed endpoints.
Both product-service
and order-service
use Postgres as the datastore which is accessed using TypeORM.
Run the following docker command to spin up all the required containers:
docker compose up -d
Add seed data to populate products in the product-service
:
docker exec product npm run seed:run
POST /login
- returns auth access token (only supportsadmin
andpassword
as the login credentials for now)
GET /products/{id}
- returns product with given idPOST /products/
- creates a new productPATCH /products/{id}
- updates the product with the given idDELETE /products/{id}
- deleted the product with the given id
GET /orders/
- returns all the ordersPOST /orders/
- Creates a new order - returns status asCOMPLETE
if each product in the order has the required quantity available