Micro services Architecture in Nodejs

Kamran Ghyan
1 min readFeb 15, 2021

In this article I’ll create micro-services architecture for small online store.

So we are going to build online store app, In application users can list products for sale. It’s been products listed any user who signs up to our application can purchase products, checkout and make payment.

Architecture of micro-services in following diagram. Let’s have a look and try to explain as well.

Microservices Architecture

In above diagram overall design of application and application have events like user created, user updated, product created, product updated, product add, order, payment etc.

our client interact with micro services and each is connect with event bus called (NATS streaming server).

Basically NATS is work on model publisher / subscriber.

If product add into cart, product service invoked and update product status in MongoDB and event bus (NATS) trigger an event to order service and create an order with payment status pending.

Now when user made payment, payment service invoked and event bus (NATS) trigger an event to order service and update order payment status to complete in DB.

Basically NATS working as bus between different micro-services, it’s gonna receive some events from our services and then echo those events out to all of our other services.

--

--

Kamran Ghyan

Software Engineer, System Architecture, Cloud Architecture, AI enthusiastic