Skip to content
StackDecode
System Design
10. API Design and ManagementAnimated

API Contracts

Agreed behaviour between provider and consumer.

The idea

Contracts define schemas, status codes and compatibility rules; consumer-driven tests verify them.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ClientAPI gatewayAuthOrdersCatalogData
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Every client request enters through the gateway.

step:
1/4
at:
Client
1/9

The green dot is a request moving through the system.

Step by step

  1. 1Consumers state expectations
  2. 2Provider verifies them in CI
  3. 3Breaking changes fail the build
  4. 4Teams evolve safely

Where it is used

Microservice teams.

Watch out for

Contracts that are not tested drift.

Related