Member-only story
Service Weaver: A Framework From Google For Balancing Monoliths and Microservices
A new framework that runs as a modular monolith locally and a distributed microservices architecture once deployed
For what feels like forever, there has always been the back-and-forth between what is better: monoliths or microservices?
Depending on who you ask, and their experiences, you’ll get a different answer each time. In most cases though, it often depends on many factors, such as the size of the company, how much traffic you need to serve, as well as the product offered.
In reality, both approaches have pros and cons. But, what if you could have the best of both worlds? That’s what Google’s new open source framework aims to give you, so let’s take a closer look!
What Is Google’s Service Weaver?
Service Weaver is a framework, currently in early development, written by Google. It’s open source, which means anyone can use and contribute. The framework is currently only available in Go, but the approach could be replicated to any language should it be successful.
It’s a framework for building distributed applications, with the twist being that it runs locally as a modular monolith, but once deployed, runs as a distributed, microservices architecture.
What is a Modular Monolith?
For anyone not familiar, a modular monolith is an architecture where the entire architecture is written as a single application, in a single repository. The modular aspect means the monolith is separated into separate components, with clean and clear interfaces between the different components.
Here’s an example:

In this monolith, there are three components: order, payment and shipping. Each one implements a specific part of the monolith, with the key being the majority of each component is private, and any communication between components is through a clearly-defined interface.