Software → Software Architecture
Middleware
Software that sits between components, frameworks, or systems to process, adapt, or coordinate communication.
Motivation
Middleware solves the problem of applying cross-cutting behavior around request handling without duplicating it in every endpoint.
Where it fits
Middleware belongs to programming, APIs, and web application architecture. It is often used for authentication, logging, validation, rate limiting, and error handling.
Mental model
A request flows through a chain of small components before reaching the main handler.
Common mistakes
- Putting business logic into middleware.
- Making middleware order unclear.
- Hiding too much behavior outside the endpoint code.