Mind~G
System-Design

Monolithic & Microservices

What is Monolithic Architecture?

A Monolithic application means everything is built together in one big piece (one program).

All parts (like login, payment, product, etc.) live together in one codebase and run as one single unit.

Example

Imagine a Restaurant App 🍔

  • Login system
  • Menu system
  • Order system
  • Payment system

All of these are written in one project —> like one big codebase.

+---------------------------------------+
|        Restaurant App (One Piece)     |
|---------------------------------------|
|  Login | Menu | Order | Payment       |
+---------------------------------------+

If you want to change the Payment part —> you must rebuild and redeploy the whole app again

What is Microservices Architecture?

A Microservices app means the app is split into small, independent services.

Each service does only one job, and they talk to each other (usually over a network).

Example

Same Restaurant App, but now divided:

+------------------------+
|   Login Service        |
+------------------------+
|   Menu Service         |
+------------------------+
|   Order Service        |
+------------------------+
|   Payment Service      |
+------------------------+

Each part is a separate service, like:

  • Login runs on its own server
  • Menu runs on another
  • Payment runs on another

If you want to change Payment, you can do it without touching the others

Differences

FeatureMonolithicMicroservices
StructureOne big unitMany small services
DeploymentDeploy everything togetherDeploy each service separately
ScalingHard to scale one partEasy to scale individual parts
FailureOne bug can crash allOne bug only affects that service
ExampleOne restaurant appMany small apps working together

How They Connect to Databases

Monolithic Architecture

All features live inside one Node.js app and use one shared database.

Microservices Architecture

Each feature is a separate Node.js app, and each one can have its own database.

On this page