Welcome Software Architects,

Monolith Applications:

Monolith applications or a single tired applications are in which the UI and your backend logic is inside of a single codebase, for example a Node.js web app in which your frontend code and backend code is in single application like the below:

So if you have any kind of services or functionalities are in your product then everything bind inside of a single service.


Split your application to more meaningful units or functional pieces called Microservices and these services will interact together using some message passing softwares and programs call Message brokers.

Now let's talk about Pub-sub or Event-driven or Producer-Consumer; all these fancy words are derived to the same concept, a queuing system or a data event-driven tool  (Message brokers) like Kafka or RabbitMQ will manage all your data flow between your applications. A publisher or Producer will send there data or messages to the queuing system and this will pass the data to all it consumes.

Benefit: Even if your one service is down your message broker will hold the message and when it live again broker will send that message to that subscriber or service.

Queuing vs publish-subscribe

Consumer groups is another key concept and helps to explain why Kafka is more flexible and powerful than other messaging solutions like RabbitMQ. Consumers are associated to consumer groups. If every consumer belongs to the same consumer group, the topic's messages will be evenly load balanced between consumers; that's called a 'queuing model'. By contrast, if every consumer belongs to different consumer group, all the messages will be consumed in every client; that's called a 'publish-subscribe' model.

Where to use?

  1. You can use microservices if your product is a video streaming or data streaming analytics platforms.
  2. payment services ( split into customer creation service, payment service, etc)
  3. Authentication as a separate service like JWT as service
  4. Image/video uploading service
  5. ETL

and so on.

When you develop applications make each service as container using docker and make managing it using Kubernetes kind of tools.

Microservices + Kafka + docker = ❤️

Watch the below video from Netflix geek on how they split their apps into Node.js Microservices.

Happy coding 👍🏻