How to decide between microservices and a monolith

H

"Should we build a monolith or use microservices?"

This is probably one of the first question every new software development team asks itself.

The answer will almost always turn out wrong, because the team won't know what they'll need until the software is operational in production.

I recommend to adopt a development process that allows to postpone this decission and stay flexible!

Package capabilities, compose services

Package capabilities then compose

Instead of starting to build a specific app or api, structure the code base around autonomous business capabilities.

Include any api endpoints and/or UI components that facilitate the capability in this code base.

Then package those capabilities individually, e.g. into a nuget and / or npm package.

Now create another code base for the hosting code, usually not much more than a program or UI shell entry point, which in turn takes a dependency on the capability packages and calls the configuration entry point of the capability.

Finally build the collective into a modular monolith or autonomous micro service depending on the current needs.

Should your team use a mono-repo or a multi-repo?

I always recommend multi-repo. Even when building a monolith.

Put each capability in its own repo to make it as hard as you can to take lateral dependencies between them.

Yes, I know it will cause some hurt.

But it is a good hurt... like a workout, the team will benefit from it in the long term.

About the author

YVES GOELEVEN

I've been a software architect for over 20 years.

My main areas of expertise are large scale distributed systems, progressive web applications, event driven architecture, domain driven design, event sourcing, messaging, and the Microsoft Azure platform.

As I've transitioned into the second half of my career, I made it my personal goal to train the next generation of software architects.

Get in touch

Want to get better at software architecture?

Sign up to my newsletter and get regular advice to improve your architecture skills.

You can unsubscribe at any time by clicking the link in the footer of your emails. I use Mailchimp as my marketing platform. By clicking subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.