Practice this topic in a realistic system design interview
Business logic should not care whether a request came from HTTP, a command-line tool, a message queue, or a scheduled job. It also should not care whether data is stored in PostgreSQL, MongoDB, or a file.
But in many codebases, those details slowly mix together. A controller starts making pricing decisions. A use case imports an ORM model or a payment SDK. After a while, changing a database, framework, or provider means touching business logic too.
Hexagonal architecture keeps the business logic in a separate core and connects everything else to it through clear boundaries.
This chapter covers what hexagonal architecture is, how ports and adapters keep business logic separate from databases, frameworks, and external services, and when this extra structure is worth it.