1. Single entry
The gateway is the one public endpoint clients hit, hiding the internal service topology.
entry: single-public-endpointTyporithm · medium
Step 1 of 8 · intro card
Microservices
An API gateway is the single public entry point that routes to internal services and handles cross-cutting concerns (auth, rate limiting, caching). A BFF — backend-for-frontend — tailors the API per client type; keep business logic out of the gateway.
An API gateway sits at the edge as the single public endpoint. Clients never call services directly; they call the gateway, which routes each request to the appropriate internal service and hides the topology behind it.
Because it sees every request, the gateway is the natural place for cross-cutting concerns: authentication, rate limiting, and response caching, so individual services need not reimplement them.
A BFF (backend-for-frontend) is a gateway tailored to one client type — for example separate web and mobile BFFs that shape responses for each. Crucially, keep business logic out: a gateway that accumulates domain logic becomes a fragile, central bottleneck.
Gateway = single public entry that routes to services.
Edge concerns: auth, rate limiting, caching.
BFF tailors the API per client; no business logic in the gateway.
gateway:
entry: single-public-endpoint
routing: to-internal-services
concerns: auth-ratelimit-cache
bff: backend-for-frontend
avoid: business-logic-hereConnect each part of the code to the concept before you type.
The gateway is the one public endpoint clients hit, hiding the internal service topology.
entry: single-public-endpointIt routes each incoming request to the right internal service.
routing: to-internal-servicesAuth, rate limiting, and caching live at the edge so every service doesn't reimplement them.
concerns: auth-ratelimit-cacheA backend-for-frontend tailors the API surface to one client type (web, mobile).
bff: backend-for-frontendBusiness logic belongs in the services; a gateway that grows logic becomes a bottleneck and a hidden monolith.
avoid: business-logic-hereRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.