Architecture – Which way are downstream and upstream services

Architectureterminology

For a system that consist of multiple services calling each other (e.g. Front End -> Backend -> Storage), I often heard people using terminology such as "downstream" or "upstream" services. I'm not clear which direction these mean. Data flows in both direction. Requests flow from more user-facing to more backend service, but responses flow in the opposite direction, so it seems to me one either way can be argued

Best Answer

The downstream services are the ones that consume the upstream service. In particular, they depend on the upstream service. So the front-end is downstream to the back-end because it depends on the back-end. The back-end can exist meaningfully without the front-end, but the front-end doesn't make sense without the back-end.

The dependency doesn't have to be as strong as I made it out to be in the previous paragraph. More generally, upstream services don't need to know or care about the existence of downstream services. Downstream services care about the existence of upstream services, even if they only optionally consume them.

Related Topic