This is a simple Proof of Concept (PoC) of a set of microservices (MS) implemented in Node.js and Bun, and deployed on Minikube as the Kubernetes (k8s) environment.
This project is growing and more microservices might be added in the future. Currently, the project includes the following microservices:
- api-gateway:
- Description: Responsible for handling all incoming requests into the Kubernetes cluster.
- Interface: Requests are accepted via REST.
- Language: Node.js
- auth-service:
- Description: Responsible for validating logins and creating users.
- Interface: Requests are received via gRPC.
- Language: Node.js
- catalog-service:
- Description: Manages product catalog information.
- Interface: Requests are received via REST.
- Language: Bun
To run this project locally, you will need the following prerequisites:
- PostgreSQL: Ensure PostgreSQL is installed and running locally.
- MongoDB: Ensure MongoDB is installed and running locally.
- Minikube: Ensure Minikube is installed and running.
- Hosts File Update: Update your
/etc/hostsfile to includetest.comas follows:127.0.0.1 test.com
-
Start Minikube:
minikube start --nodes=3 --driver=docker
-
Apply Kubernetes Manifests:
- Navigate to each microservice folder and apply the Kubernetes manifests:
kubectl apply -f <name_of_the_file>
-
Enable Minikube Tunnel:
minikube tunnel
-
Enable Ingress:
minikube addons enable ingress
-
Register User:
curl --location 'http://test.com/register' \ --header 'Content-Type: application/json' \ --data '{"username":"user", "password":"pass"}'
-
Login User:
curl --location 'http://test.com/login' \ --header 'Content-Type: application/json' \ --data '{"username":"user", "password":"pass"}'
-
Get Catalog Item:
curl --location 'http://test.com/catalog?catalogId=1' \ --header 'authorization: token' \ --data ''
-
Get All Catalog Items:
curl --location 'http://test.com/catalog' \ --header 'authorization: token' \ --data ''
-
Add Catalog Item:
curl --location 'http://test.com/catalog' \ --header 'authorization: token' \ --header 'Content-Type: application/json' \ --data '{"name":"testProduct", "description":"This is a test"}'
- Additional microservices may be added to enhance the functionality of this PoC.
Feel free to contribute by opening issues or submitting pull requests.
Enjoy experimenting with microservices in Node.js, Bun and Kubernetes!