DEV Community

Cover image for Software Architecture for a CHILD
Common Khadka
Common Khadka

Posted on

Software Architecture for a CHILD

🏠 What is Software Architecture?

Imagine you're building a house or a LEGO city. You need a plan β€” where the rooms go, how people move around, where the wires and pipes are. That’s what software architecture is β€” the big plan for how a software project is built and how all the parts fit together.


Now let’s look at the types of software architecture using easy examples:


1. Monolithic Architecture 🧱

Imagine a giant LEGO castle all built as one big piece.

  • All rooms are in one big structure.
  • If you want to change the kitchen, you might break the whole castle.

🟒 Easy to build at first.

πŸ”΄ Hard to change when it gets big.

🧠 Example: A single app that does everything β€” login, shop, pay β€” all in one codebase.


All in one folder β€” like a big box of LEGOs.

/MyApp β”œβ”€β”€ /controllers β”œβ”€β”€ /models β”œβ”€β”€ /views β”œβ”€β”€ /services β”œβ”€β”€ /utils β”œβ”€β”€ app.js β”œβ”€β”€ config.js └── README.md 
Enter fullscreen mode Exit fullscreen mode

Everything is tightly packed together. Easy at first, but hard to move pieces around later.


2. Microservices Architecture 🏘️

Imagine a neighborhood where each house does one thing.

  • One house for cooking.
  • One house for games.
  • One house for sleeping.

Each house talks to the others, but they can be fixed or upgraded separately.

🟒 Easy to manage and scale.

πŸ”΄ Harder to set up at first.

🧠 Example: Amazon has one service just for payments, one for searching,
one for orders.

Many small folders, each like its own tiny app.

/MyApp β”œβ”€β”€ /auth-service β”‚ β”œβ”€β”€ /src β”‚ β”œβ”€β”€ app.js β”‚ └── Dockerfile β”œβ”€β”€ /product-service β”‚ β”œβ”€β”€ /src β”‚ β”œβ”€β”€ app.js β”‚ └── Dockerfile β”œβ”€β”€ /order-service β”‚ β”œβ”€β”€ /src β”‚ β”œβ”€β”€ app.js β”‚ └── Dockerfile β”œβ”€β”€ /api-gateway β”‚ β”œβ”€β”€ /src β”‚ └── gateway.js └── docker-compose.yml 
Enter fullscreen mode Exit fullscreen mode

Each service is independent and talks to others through APIs.


3. Clean Architecture 🧼 (or Hexagonal)

Imagine a house where the living room doesn’t know where the pipes are.

  • The inside (like the people) don't care about the outside stuff (like the street or electricity).
  • You can cleanly replace the TV or the power supply without messing up the couch.

🟒 Keeps core logic safe from changes.

πŸ”΄ Takes more planning.

🧠 Example: Your game logic doesn’t care whether the player uses keyboard or touch screen.

Separates the β€œwhat” from the β€œhow” β€” like keeping your school books in subjects.

/MyApp β”œβ”€β”€ /src β”‚ β”œβ”€β”€ /core β”‚ β”‚ β”œβ”€β”€ /entities β”‚ β”‚ β”œβ”€β”€ /use-cases β”‚ β”œβ”€β”€ /infrastructure β”‚ β”‚ β”œβ”€β”€ /database β”‚ β”‚ β”œβ”€β”€ /external-apis β”‚ β”œβ”€β”€ /interface β”‚ β”‚ β”œβ”€β”€ /controllers β”‚ β”‚ └── /routes β”œβ”€β”€ app.js └── README.md 
Enter fullscreen mode Exit fullscreen mode

Core logic stays clean and isolated β€” like the rules of your game that don’t depend on who’s playing.


4. Onion Architecture πŸ§…

Imagine layers of an onion β€” each layer protects the one inside.

  • The center is your core logic.
  • Around that is stuff like business rules, then APIs, then UI.

Only outer layers talk to inner layers β€” not the other way around.

🟒 Makes the important code safe from changes outside.

πŸ”΄ Can be hard to understand at first.

🧠 Example: You can change the way data is saved (database) without touching your game rules.


Layers that protect the core, like a security system around your treasure.

/MyApp β”œβ”€β”€ /Domain β”‚ └── /Entities β”œβ”€β”€ /Application β”‚ └── /UseCases β”œβ”€β”€ /Infrastructure β”‚ β”œβ”€β”€ /Data β”‚ └── /External β”œβ”€β”€ /Presentation β”‚ └── /Controllers β”œβ”€β”€ app.js └── README.md 
Enter fullscreen mode Exit fullscreen mode

Outer layers (like controllers) depend on the inner logic, but never the other way around.


5. Layered Architecture 🍰

Like a cake with layers β€” base, cream, topping.

  • Each layer does one job:
    • Data layer (bottom): like the fridge with all the food.
    • Logic layer (middle): the cook that makes the food.
    • UI layer (top): the waiter that serves it.

🟒 Easy to organize and understand.

πŸ”΄ Sometimes layers talk too much and get messy.

🧠 Example: Your app’s UI doesn’t need to know how the database works β€” it just asks for stuff.


Stacked like a birthday cake πŸŽ‚ β€” base, middle, and top layers.

/MyApp β”œβ”€β”€ /PresentationLayer β”‚ └── /UI β”œβ”€β”€ /BusinessLogicLayer β”‚ └── /Services β”œβ”€β”€ /DataAccessLayer β”‚ └── /Repositories β”œβ”€β”€ /Common β”‚ └── /Helpers β”œβ”€β”€ app.js └── README.md 
Enter fullscreen mode Exit fullscreen mode

Each layer only talks to the one right below or above it. Like a kitchen: waiter β†’ chef β†’ fridge.


πŸ’‘ In short:

Type Like a... Good for
Monolithic One big LEGO block Small apps
Microservices Tiny houses in a city Large, fast-growing apps
Clean Tidy and independent rooms Testable, flexible code
Onion Onion with strong core Safe core logic
Layered Layer cake Simple and organized apps

Top comments (0)