System Design · Guide

Monolith

Modular monolith, when to stay monolithic, migration paths.

— min read System Design

Theory

Monolith: Modular monolith, when to stay monolithic, migration paths.

A monolith deploys all application logic as a single unit — shared process, shared database, unified release cycle. It is the fastest path to MVP: simple debugging, ACID transactions across features, no network latency between modules.

A modular monolith enforces package boundaries and domain interfaces within one deployable — gaining structure without microservices overhead. Extract services later when scaling or team boundaries justify the distributed complexity.

Stay monolithic while the team is small and domain boundaries are still emerging. Split when independent scaling, polyglot persistence, or Conway-aligned team autonomy outweigh the cost of distributed operations and eventual consistency.

Production rollouts require idempotent automation, peer review, staged apply, and documented rollback — treat changes as production code.

Interviewers want STAR stories linking Monolith to measurable outcomes: fewer outages, faster deploys, lower cost, or reduced toil.

Architecture Diagram

Users / clients
         |
  Monolith
         |
  Core services
         |
  Data + observability

Examples

bash
# Monolith
# Modular monolith, when to stay monolithic, migration paths.
# Validate in staging before production rollout.

Interview Questions

What problem does Monolith solve?

It addresses the core use case described in production architecture — map features to reliability, scale, or velocity outcomes.

Key components of Monolith?

Identify inputs, outputs, control plane, data plane, and failure domains — interviewers want structured decomposition.

Common production pitfalls?

Misconfiguration, missing observability, no rollback path, and scaling bottlenecks under peak load.

How do you test changes safely?

Staging parity, canary/gradual rollout, automated health checks, and documented rollback.

Metrics to prove success?

Error rate, latency percentiles, throughput, cost, and toil reduction — pick one primary SLO.

Beginner vs advanced concern?

Beginners focus on setup; advanced teams focus on blast radius, security boundaries, and operability at 10× scale.

Best Practices

  • Treat Monolith config as code with review and CI validation.
  • Define SLOs and dashboards before production cutover.
  • Document rollback and ownership for on-call.
  • Use least privilege for credentials.

Common Mistakes

  • Adopting Monolith without measurable success criteria.
  • No staging environment mirroring production constraints.
  • Missing rollback path during incidents.
  • Undocumented on-call expectations.

Trade-off Analysis

Monolith improves modular monolith, when to stay monolithic, migration paths. but adds operational and cognitive complexity — justify with load and team size.

Favor simplicity until metrics (p99 latency, error rate, cost) prove the pattern necessary.

Every redundancy layer trades capital/operational cost for availability — align with explicit SLO targets.

Document accepted inconsistency windows and recovery behavior before production cutover.

Cheat Sheet

MonolithModular monolith, when to stay monolithic, migration paths.
SLOService level objective
RollbackRevert to last known good
CanaryLimited blast-radius rollout
RunbookIncident steps

Practical Exercises

Monolith sandbox

Stand up Monolith locally or in free tier; document commands and failure recovery.

Failure drill

Introduce misconfiguration; practice detection and rollback under time limit.