Few architecture debates generate more heat than monolith versus microservices. The useful question is not which is better, but which problems you actually have. Microservices trade simpler individual services for a more complex system. A modular monolith keeps one deployable unit but enforces strong internal boundaries. For many teams, that second option is the better starting point.

Definitions

  • Modular monolith: one application, deployed as one unit, organized into modules with explicit public interfaces and private internals.
  • Microservices: several independently deployable services, each owning its data, communicating over the network.

The distinction is where the boundaries are enforced: by the compiler and code review inside one process, or by the network between processes.

What microservices cost you

  • Distributed system failure modes. Calls can time out, fail halfway or arrive twice. You need retries, idempotency and timeouts everywhere.
  • Data consistency. A transaction across two services is no longer a database transaction. You use sagas or eventual consistency.
  • Operational overhead. Many pipelines, deployments, dashboards, alerts and on-call rotations.
  • Harder debugging. A request spans services, so you need tracing and good correlation IDs.
  • Cost. More infrastructure, more network traffic, more tooling.

What they give you

  • Independent deployment so teams can ship without coordinating releases.
  • Independent scaling of the few components that need it.
  • Technology flexibility where a component genuinely needs a different stack.
  • Fault isolation when designed well.

A decision guide

Lean toward a modular monolith when:

  • You have one team or a few small teams.
  • The domain is still being discovered and boundaries will move.
  • You do not yet have mature automation, monitoring and deployment practices.
  • Most of your load scales together.

Lean toward microservices when:

  • Several teams are blocked by shared deployments.
  • Parts of the system have very different scaling, availability or compliance needs.
  • The boundaries are well understood and stable.
  • You have the platform skills to run many services.

How to build a modular monolith well

A modular monolith only works if the boundaries are real. A typical layout in .NET:

src/
  Shop.Web/                 // host: composition root only
  Modules/
    Orders/
      Orders.Contracts/     // public interfaces and DTOs
      Orders.Core/          // internal domain and data access
    Billing/
      Billing.Contracts/
      Billing.Core/

Rules that make it hold:

  1. Modules talk only through contracts. Make implementation types internal.
    // Orders.Contracts
    public interface IOrderQueries
    {
        Task<OrderSummary?> GetSummaryAsync(Guid orderId, CancellationToken ct);
    }
    
    // Orders.Core
    internal sealed class OrderQueries : IOrderQueries { /* ... */ }
  2. Each module owns its tables. No other module reads them directly, and no cross-module joins.
  3. Prefer events for side effects. Publish an in-process event when an order is placed, and let Billing react.
  4. Enforce the rules automatically with architecture tests or analyzers, so boundaries do not erode.

Leaving room to split later

If a module's boundaries, data ownership and contracts are clean, extracting it into a service later is mostly mechanical: replace the in-process call with a network call and move the tables. If the modules reach into each other, splitting will be painful whichever style you picked.

Bottom line

Start with a modular monolith unless you have concrete reasons not to, keep the boundaries honest, and split only when a specific pain justifies the added complexity. The same cost thinking applies in the cloud; see our AWS cost optimization checklist.

References