Skip to content

Gateway Pattern

Medium — good to knowArchitecture

ELI5 — The Vibe Check

A gateway wraps access to an external system behind a nice, clean interface. Your code talks to the gateway, and the gateway handles the messy HTTP calls, XML parsing, and retry logic. It's the diplomat between your clean code and the ugly outside world.

Real Talk

An object that encapsulates access to an external system or resource, providing a domain-friendly interface. Gateways abstract away protocol details, data format differences, and connection management. Unlike repositories (which abstract data storage), gateways typically wrap external APIs, messaging systems, or third-party services.

When You'll Hear This

"The payment gateway wraps Stripe's API so our domain code never deals with HTTP requests." / "If we switch from Stripe to Braintree, we just write a new gateway — the use cases don't change."

Made with passive-aggressive love by manoga.digital. Powered by Claude.