Skip to main content

How do microservices differ from a monolith?

A monolith is an application where all the code (logic, interface, database) is combined into one common block. Microservices are a set of separate modules, each of which is a self-contained service with its own logic and database.


The main difference

CharacteristicMonolithMicroservices
StructureEverything in one applicationSplit into independent services
DevelopmentOne codebase, one teamMany teams, each responsible for its own service
DeploymentEverything is updated at onceA single service is updated
ScalingOnly the whole applicationSelective - only the needed services
DependenciesStrong couplingLoose, through APIs
Data storageShared databaseA separate database for each service

Example

Monolith: an online store where one server handles orders, payments, and delivery. Microservices: orders, payments, and delivery are three separate services that communicate through APIs.


Summary: A monolith is simpler at the start but harder to scale. Microservices are more complex in infrastructure but provide flexibility, independence, and resilience to failures.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.