Search code examples
architectureevent-driven

Why not monolithic event driven architecture?


I have been building event driven micro services. Then, I was wondering, why not event driven monolithic applications.

Now the down side would be scalability issues. I would not be able to make replicas for specific traffic intensive domains.

But other than that I still get many other benefits such as

  1. eventual consistency
  2. I also personally find it easier to debug with the right setup, since I can replay the events.
  3. reduced complexity. decoupling between domains(we still have domains managed in folders)

Additionally we have the monolith benefit: mainly reduced devops.

When the application gains popularity(and so more traffic) then we can easily convert it to micro services. I think converting the code from non event driven to event driven is the most challenging part as it changes the overall architecture significantly.

One criticism I can think of is, is it worth to manage an event bus just for a monolith? If I were to use something like apache kafka, which is quite expensive and challenging to manage, it might not be worth it.

But if I were to use something like NATS Streaming or Redis stream, which more or less does the same job as apache kafka, but light weight and much easier to manage, then I dont think this would be a problem either.

When I google I cant find articles about such ideas, so I am wondering if I am missing something significant.


Solution

  • In my new project, I have tried "event driven modular monolith" and the dev experience so far is amazing. I have also made a npm library, event-driven for this, in order to make "event driven architecture" easy. There is a rather complex layer over the message broker, to make pub/sub flawless with replay feature and dead letter queue. It is still basic, but feel free to take a look into it, if anyone is interested.