#9: Microservices and API Contracts

video locked
Enroll to watch

16 mins

A microservice is a service owned by one team, with its own deployment cycle and its own setup.

The team grows from 5 engineers to 15. Stand-ups carry non-overlapping updates, features take longer to ship, new engineers need hand-holding, and nobody is an expert at payments. The root cause is a single server's code with too many people changing it.

The team is split into three: orders and payments, inventory, and communications. Each team deploys independently, scales its own service and is reached through API calls.

Three drawbacks:

  1. Other teams know only the API signatures.
  2. Logging and caching are set up by every team, so effort is duplicated.
  3. A function call becomes a network call, which is less efficient.

Teams split too quickly devolve into nano services: more projects than people.

Every team publishes its API contract to one repository and ships a client library. A change from t-shirt ID to item ID and item type is a breaking change. A null item type treated as t-shirts keeps the API backward compatible.