What about potential microservices? #84
-
I really like this project. I think this repo is the thing that helped me with the "click" in my mind about CQRS. Thanks for this entire work! I'm wondering about migration to microservices from this architecture. I always hear about the modular monolith is a great architecture to migrate to microservices. But what about read models? In which place should they be put in potential microservices? The only solution that comes to my mind, is to use the "backend for frontend" pattern and make the BFF service from the The second thing which makes mi wonder is about using repositories directly from the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thanks for the kind words Mateusz! Let me start with a disclaimer: I'm not a big fan of extracting microservices just for the sake of it. Going microservices means that you no longer control the database transaction as easily as in the modulith. That said/disclaimed: Read models do fit well as microservices. They would consume the events and build the storage data. They are isolated, autonomous. They can be easily rebuilt, rewritten, optimized etc. Frontends can then talk directly to the read model microservices - its role is only to expose the data in the most frontend-oriented possible way. The second thing (customers_controller) - it was a technical debt and was already refactored/fixed/eliminated :) Thanks to that we longer have read models being dependent on anything else - they're now fully autonomous. I hope this helps. Apologies for late answer - I somehow missed this question. Happy to help if you have any further question. |
Beta Was this translation helpful? Give feedback.
-
I share Andrzej's sentiment about microservices. I think they are justified mostly when
That said, a modulith seems like the best "basecamp" to attack the "peak" of microservices. I think the key topics to consider when moving from a modulith to microservices are:
That said there seems to be yet another stepping stone between modulith and microservices: making the flows asynchronous. Perhaps it's safer to attack this "base" first. It's going to be easier to pull out when things go wrong :) |
Beta Was this translation helpful? Give feedback.
-
Thanks for replies, everything is clear now 100% agree with your opinions about microservices :) |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words Mateusz!
Let me start with a disclaimer: I'm not a big fan of extracting microservices just for the sake of it.
Microservices (as in the popular definition - json over http) - do bring some additional complexity.
Going microservices means that you no longer control the database transaction as easily as in the modulith.
That said/disclaimed:
Read models do fit well as microservices. They would consume the events and build the storage data. They are isolated, autonomous. They can be easily rebuilt, rewritten, optimized etc.
Frontends can then talk directly to the read model microservices - its role is only to expose the data in the most frontend-oriented possible way.