# From monolith to microservices: when, why, how

> Why start with a modular monolith, what microservices cost, four measured signals that justify the move, and carving out a module with the strangler pattern.

- Kind: Presentation
- Published: 2026-10-03
- Slides: 21
- Based on these articles: https://muhammetsafak.com/engineering/essays/why-i-start-with-a-modular-monolith/ · https://muhammetsafak.com/engineering/essays/when-i-move-to-microservices/ · https://muhammetsafak.com/engineering/essays/why-boring-architecture/
- Source: https://muhammetsafak.com/visuals/d/from-monolith-to-microservices/
- Language: en-US
- Author: Muhammet Şafak

---
## Slide 1 — From monolith to microservices

Muhammet Şafak — Visuals

When, why, how: draw the boundary today, split the deployment once a measured signal arrives.

Muhammet Şafak October 3, 2026

## Slide 2 — Boundary

Section 01

Modular monolith: one codebase, one deploy, one database; clear module boundaries inside.

## Slide 3 — Where does the boundary sit?

Three approaches

Where does the boundary sit?

| Approach | Boundary |
| --- | --- |
| Classic monolith | No boundary. Everything reaches everything, and over time it becomes a "big ball of mud". |
| Microservices | There is a boundary, but the boundary is also a network call. |
| Modular monolith | There is a boundary, but it lives inside the process; it is a method call. |

## Slide 4

The real issue

Boundary, service: two decisions.

Draw the boundary today, split the deployment when it is really needed.

## Slide 5 — One public surface per module

The boundary in code

A module calls only the `*Api.php` class of another module. It never runs a `SELECT` directly against another module’s table and never ties a foreign key to it.

app/Modules

```
1app/2└── Modules/3  ├── Billing/4  │   ├── Domain/         # module's entities, value objects5  │   ├── Application/    # use cases6  │   ├── Infrastructure/ # repositories, external adapters7  │   └── BillingApi.php  # the module's ONE public surface8  ├── Catalog/9  └── Notification/
```

## Slide 6 — Five concrete reasons

Why I start here

-   Cheap to fix A wrongly drawn boundary is fixed with one refactor.
-   One transaction Two modules update consistently inside a single DB transaction.
-   Less operations One deploy, one log stream, one thing to monitor.
-   Refactoring tools The compiler verifies a method call.
-   Cheap migration Extracting a module with a clear boundary into a service is mechanical work.

## Slide 7 — Four practices that keep the boundary standing

Discipline

-   The dependency rule runs in CI; a violation breaks the build (deptrac) (done)
-   Each module's public API is a single class (done)
-   Relations between modules are an ID + a public call, not a foreign key (done)
-   Review question: does this change cross a module boundary without permission? (done)

## Slide 8

All the value is in the discipline

No CI check, no boundary.

If the boundary isn't enforced by CI, what you have isn't a modular monolith, just a monolith with tidy folder names.

## Slide 9 — Cost

Section 02

Microservices are not a solution, they are a trade-off.

## Slide 10

One change

A method call turns into a network call.

What you get is independent deployment and independent scaling. What you pay in return is long.

## Slide 11 — The microservices bill

Trade-off

|  | In microservices | In a monolith |
| --- | --- | --- |
| Call | Serialization, latency, partial failure | In-process, free |
| Consistency | Saga, outbox, eventual consistency | A single DB transaction |
| Observability | Distributed tracing required | One log stream |
| Deploy | Versioned, backward-compatible contracts | One deploy |
| Refactor | A contract nobody verifies | The compiler verifies |

## Slide 12 — The wrong medicine for the right disease

Wrong reasons

A 200-thousand-line monolith and 200 thousand lines split into 20 services are the same amount of code; the second one just has a network in between.

| Reason | The real fix |
| --- | --- |
| "The codebase is too big." | Module boundaries, file layout, dead code cleanup |
| "Deploys are slow and scary." | Fast pipeline, tests, gradual rollout, rollback |
| "I need to scale independently." | Monoliths scale out too: N copies + load balancer |
| "This is modern architecture." | Modern is not an architectural reason |
| "Netflix does it this way." | Not the problem, only the operational load gets copied |

## Slide 13

Code size

Same code, plus a network.

A 200-thousand-line monolith and 200 thousand lines split into 20 services are the same amount of code; the second one just has a network in between.

## Slide 14 — Signal

Section 03

At least one of these signals must have been measured.

## Slide 15 — Four signals that justify the move

Measured signals

-   Scaling profile One part consumes resources very differently from the rest.
-   Ownership Teams wait on each other's deploys; the boundary is organizational.
-   Runtime A measured bottleneck: the workload is clearly cheaper in Go or Rust.
-   Fault isolation One module's crash must not take the system down; it can't be achieved in-process.

## Slide 16

Threshold

Not on a graph? Not a signal.

If a signal doesn't show up on a graph, it is not yet a signal.

## Slide 17 — Migration

Section 04

Not everything: split out the single module that gives the signal.

## Slide 18 — Taking one module out

Strangler pattern

1.   Step 1: Pick the module `the one module giving the signal`
2.   Step 2: Build the service `the new service comes up`
3.   Step 3: Shift the traffic `calls are routed gradually`
4.   Step 4: Delete the old `the old code is deleted`

## Slide 19 — When to split, and how not to

When, and when not

-   **Big-bang** Splitting everything at once is the most expensive migration and the one that fails most often.
-   **Team** When several teams are squeezed into the same deploy unit.
-   **Resource** When one part's resource profile holds the rest of the system hostage.
-   **Crash** When one component's crash regularly takes down the whole system.

## Slide 20 — The complexity budget is limited

Boring architecture

-   PHP + Laravel or Symfony; the application layer.
-   PostgreSQL Relational database.
-   Redis In-memory data store.
-   Nginx Web server.
-   Linux Process management with systemd + Supervisor.
-   New tool My threshold for boring: 12–18 months of active use in production.

## Slide 21 — Thank you

[muhammetsafak.com/engineering/](https://muhammetsafak.com/engineering/)

Draw the boundaries early, deploy late. Wait for the signal; let measurement make the decision, not fashion.
