Modular-services in a Nodejs Monolith
Microservices are described as services with a few hundred lines of code. Big organizations run such micro services in 100’s and are often looked up to by engineers in startups/smaller companies, too eager to join that league. However the hard reality is that only a few startups will survive to scale and need micro services. Busting the hype, the experts are suggesting smaller companies to adopt writing modular code instead of microservices code. How do you write modular code in NodeJs and why are they better than microservices?
Modules are blocks of functionality that are bigger than micro services, a few files ideally. A few modules can be piped/joined together to make an app. They share a lot of similarities to micro services and hence to title — modular services in a monolith. A well written modular code can be broken up into microservices (when being deployed) and also tested upon as a single app (when running on a laptop). I will introduce a dependency chaining library ArchieJs (https://github.com/archiejs) and how the modules in ArchieJs are the way to architect your Nodejs monolith.
Other recent developments outside of NodeJS world on this topic is inclusion of ‘module’ construct in Java 9. The first part of this talk is inspired by similar talks from Java world. The second part ventures into implementing the modular architecture tenets in the Js world.
- Compare Modular Monoliths to Microservices - engineering complexity, cost, etc
- Introduction to Tenets of Modular development
- Using Archiejs to implement Modular architecture
- Challenges to splitting monoliths into services; and how Archiejs addresses them
PS… I can alternatively do a crisp talk also.
I have been building nodejs applications for many years and have built mostly monoliths or worked in SOA environments. I started using a library - architect.js in 2013 and have written a lot of code following the modular pattern. I am reusing code from the modules I wrote in 2013-14 in a project I am working on these days. Another of my recent interesting app is www.halfchess.com (a variation of chess).