Module 11 / Microservices

Module 11 · lesson 4 of 7 · Read 8 min

API gateways

One front door for many services.

When Tiffin was one app, the customer app had one place to send requests: api.tiffin.app. Now there are half a dozen services or more, each with its own address. Does the customer app need to know all of them? Does each service check login tokens, enforce rate limits and handle TLS on its own?

Usually not. Most microservice systems put one component at the edge that every outside request goes through. That's the API gateway.

One front door

An API gateway is a server that sits between clients and your services. It receives every external request, does the work common to all of them, and forwards each one to the right service.

Customer app
→
API gatewayauth, limits, routing
→
Orders
Catalogue
Accounts
The customer app talks to one address. The gateway decides which service handles each request.

The customer app still calls api.tiffin.app. It has no idea how many services are behind it, and that's the point. You can split, merge, move or rename services without shipping a new app to millions of phones.