Every few months, I audit a codebase for a 10-person software company that split its product into twelve microservices before reaching product-market fit. Instead of shipping customer features, their engineers spend half of every sprint keeping Docker Compose running on laptops, chasing dropped RabbitMQ events, and coordinating four pull requests just to add one field to an invoice.
On the flip side, I have also inherited 400,000-line monoliths where changing a tax calculation breaks user onboarding because every controller queries every table directly.
Neither extreme is an architectural virtue. Choosing between a monolith and microservices is an organizational and economic decision, not a resume badge. Here is how CTOs and engineering leaders should evaluate the trade-offs.
Why Microservices Are Often Misapplied
Microservices were popularized by companies operating hundreds of engineers across independent product squads. Their primary problem was not "how do we handle 500 requests per second?"—a single well-tuned monolith handles that easily—it was "how do we prevent 40 teams from stepping on each other's deployments?"
The Distributed Monolith Trap
When a small team splits a tightly coupled domain across separate HTTP or gRPC services without clear data ownership, they build a distributed monolith. You still cannot deploy Service A without updating Service B, except now an in-memory function call that took 0.05 milliseconds takes 15 milliseconds over the network and can partially fail halfway through.
Replacing ACID Transactions with Sagas
In a monolith backed by PostgreSQL or MySQL, creating an order, reserving stock, and logging a ledger entry happens inside one atomic BEGIN ... COMMIT block. Across microservices, each service owns its own database. Maintaining consistency requires outbox tables, saga orchestrators, compensating transactions, and reconciliation jobs—significant complexity that provides zero user-facing value if your team has fewer than 20 engineers.
The Modular Monolith: The High-Leverage Middle Ground
You do not have to choose between a "big ball of mud" monolith and twelve Kubernetes deployments. A modular monolith gives you one deployable unit and one primary database, while enforcing strict module boundaries inside the codebase.
Enforce Boundaries Through Module Contracts
Each domain module (Billing, Catalog, Identity, Fulfillment) exposes a small public API (service classes or domain DTOs) and keeps its internal models, repositories, and database tables private to itself. Other modules never JOIN directly across another module's internal tables.
src/
├── Modules/
│ ├── Billing/
│ │ ├── Public/BillingGateway.php <-- Only entry point for other modules
│ │ ├── Internal/LedgerEntry.php
│ │ └── Internal/StripeWebhookHandler.php
│ ├── Identity/
│ │ ├── Public/AuthContext.php
│ │ └── Internal/SessionStore.php
│ └── Fulfillment/
│ └── Internal/ShipmentDispatcher.php
You can enforce these import boundaries automatically in CI using static analysis tools (such as Deptrac in PHP, ESLint boundary rules in TypeScript, or ArchUnit in Java). If you want to see how this looks in a real legacy cleanup, read my walkthrough on refactoring monolithic PHP to modular architecture.
Use In-Process Domain Events Before Message Brokers
Inside a modular monolith, Billing can emit InvoicePaid through an internal event dispatcher or a transactional outbox table, keeping Fulfillment decoupled from checkout controllers without introducing Kafka on day one.
Side-by-Side Comparison for Decision Makers
| Decision Dimension | Modular Monolith | Microservices Architecture | Business Impact |
|---|---|---|---|
| Team Size Fit | 1 to ~25 engineers | 25+ engineers across autonomous squads | Avoids coordination tax early |
| Feature Velocity | High (single PR, single deploy) | Lower initially (multi-repo contracts, versioning) | Faster iteration to revenue |
| Data Consistency | Native ACID transactions | Eventual consistency, outbox/sagas | Simpler financial/inventory integrity |
| Runtime Failure Modes | Process crash, DB contention | Partial network failures, retries, clock skew | Narrower blast radius vs. simpler ops |
| Infrastructure Cost | Low (app servers + managed DB + Redis) | Higher (service mesh, tracing, broker clusters) | Preserves runway for product work |
| Scaling Granularity | Horizontal clones of whole app + worker pools | Independent scaling per heavy workload | Microservices win for asymmetric loads |
Objective Signals That Justify Extracting a Service
Moving from a modular monolith to selective services works best as an evolutionary step backed by telemetry, not speculation. As Martin Fowler's architecture guidance notes, teams consistently succeed faster when they start monolith-first and extract along proven seams.
1. Asymmetric Compute or Runtime Profiles
If 95% of your app is standard CRUD, while 5% runs headless Chromium PDF rendering, FFmpeg video transcoding, or Python ML inference, extract just that workload into a dedicated worker service. Your core product stays simple while heavy compute scales on GPU or high-memory nodes.
2. Strict Compliance or Security Isolation
Handling raw payment card data (PCI-DSS) or healthcare records often justifies isolating a vault or tokenization service with separate network rules, audit logs, and minimal dependencies.
3. Deployment Contention Across Independent Teams
Once three or more squads block each other's release pipelines daily—and static module boundaries no longer stop shared database migrations from stalling deploys—splitting out bounded contexts lets teams ship independently.
How to Extract a Service Without Stopping Product Delivery
If you already operate a monolith and have a verified bottleneck, use the Strangler Fig pattern rather than a multi-month rewrite.
Step-by-Step Extraction Sequence
# Example traffic-splitting progression via reverse proxy / API gateway
extraction_phases:
phase_1_shadow:
route: /api/v1/reports/*
primary: monolith
shadow_copy_to: reporting-service # Compare outputs & latency silently
phase_2_canary:
route: /api/v1/reports/*
weights:
monolith: 90
reporting-service: 10
phase_3_cutover:
route: /api/v1/reports/*
weights:
monolith: 0
reporting-service: 100
- Stabilize the internal interface: Ensure all callers talk to one clean module facade inside the monolith.
- Duplicate or sync the data via outbox: Replicate only the state the extracted service needs so it stops querying the monolith's database.
- Shadow test: Mirror live read traffic to the new service and diff responses before routing real customers.
- Cut over incrementally: Shift traffic 10% -> 50% -> 100% with an instant rollback toggle.
Understanding where to draw these boundaries also depends on whether you need a traditional feature builder or an embedded engineer who can diagnose live production constraints—a distinction I cover in Forward Deployed vs Full Stack Developer.
Scoping Architecture Decisions That Match Your Runway
Architectural complexity compounds every month. Over-engineering slows down small companies just as surely as ignoring module boundaries slows down scaling ones.
When companies bring in SmitDev through our software engineering services or custom web application development, we start by mapping your team size, deployment cadence, and actual traffic bottlenecks—not by pushing trendy infrastructure. Whether you need to build a clean modular monolith from scratch or safely peel a high-load service out of a legacy app, I offer dedicated senior delivery at $55/day (8–9 hours) or $1,999/month.
If your engineering team is drowning in cross-service coordination—or your monolith has become too fragile to deploy on Fridays—book a technical architecture review and we will put together a pragmatic roadmap.