Build Node project with micro service – Part 1(Architecture)

 

In this series, we will complete an entire lifecycle of a microservice-based project. Following are the topics which will be covered in this series:

  1. The architecture of System, technology stack and development environment.
  2. Module segregation, creation, and interaction among them.
  3. Proxy and Reverse Proxy setup.
  4. Authentication and Authorization.
  5. Containerization and Orchestration. 
  6. Deployment and Monitoring.

 

What is Microservices? 

It’s also known as the microservice architecture – is an architectural style that structures an application as a collection of services that are

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities
  • Owned by a small team

The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.

 

Technology/API Stack

We will go top-down:

Kubernetes

For orchestration. It will take care of the number of nodes to be active. Increase/decrease based on traffic. Restart if down, etc.

Docker

For containerize all the independent services.

NGinx

For reverse proxy and proxy for microservices. 

Redis

For session sharing among microservices and user.

MySQL

For database.

NodeJS

For server-side coding

ExpressJS

For web framework in NodeJS.

HelmetJS

For securing ExpressJS.

RequestJS

For inter Microservices communications.

Nodemon

For code hot swap.

Debug

For debugging logs.

Passport

For server side session management.

JWT

For token management.

The Architecture


Only port 443 will be open to the outside world. Everything will be through https port. Nginx will be handling all the requests/response. It will be a proxy for all the web services residing in Cluster. It will be also acting as a reverse proxy to redirect requests to respective microservices.

 

All the authentication will be done by the Nginx and authorization by individual microservices(More to this on later parts). We will be using JWT for authN & authZ.

 

Redis will be storing session in an encrypted format and sharing among all the services.

 

MySql will be used to store user data, encrypted password, roles, etc.