All Posts
Architecture 8 min read

Why we decomposed three microservices back into a modular monolith

#architecture#system-design#microservices

Microservices solve organizational scaling problems for teams with hundreds of developers. But for early and growth-stage companies, adopting microservices too early is often architectural self-harm. We recently helped a fintech startup merge three separate services (auth, payments, and notifications) back into a single unified TypeScript modular codebase.

The symptoms of microservice bloat

Before the consolidation, shipping a simple "Send invoice receipt email" feature required:

- Updating gRPC protobuf definitions across three repositories - Coordinating deployments across three separate Docker services - Managing distributed two-phase commits across two distinct databases - Debugging network flakiness when internal service meshes intermittently dropped requests

A feature that should have taken half a day took two sprint cycles.

Designing a true modular monolith

A monolith does not mean spaghetti code. We enforced strict structural boundaries using TypeScript project references and domain-driven module boundaries:

- Each domain module (Users, Payments, Billing) has its own private internal models and a public contract interface - Cross-domain calls occur via typed in-memory method invocations, not network HTTP/gRPC hops - Database transactions can wrap cross-domain operations in single atomic ACID units without distributed sagas - ESLint boundaries prevent internal module files from being directly imported outside their public facade

The measurable outcome

The results after 60 days in production:

- CI/CD build and deploy times dropped from 22 minutes to 4 minutes - Zero distributed transaction failures or orphaned state records - Feature velocity increased by over 300% as developers worked in a single codebase with instant type checking across boundaries

Build modular boundaries first; extract network services only when independent scaling or separate team ownership strictly demands it.

Have a similar challenge?

We build production-grade software for companies that need it done right.

Let's Talk