contract-first design
Define an interface before implementing its producers and consumers.
Use this when Frontend and backend implementations disagree on request or response formats.
without the term
“The frontend expects one shape of data and the backend sends another, and every fix breaks the other side. Can we agree on exactly what the API looks like first and then build both to match?”
with the term · How do you ask a model for contract-first design?
Define this API contract before implementing either side. Validate requests, responses, and error cases against the same schema.
What is contract-first design?
Both sides build against the same written interface, including data shapes, error responses, and what counts as a compatible change. Both sides check it.
Why does contract-first design matter when vibe coding?
Two generated implementations can use plausible but incompatible schemas.
How do you do contract-first design?
Agree on a small contract and run checks from both sides of the boundary.
What goes wrong with contract-first design?
Changing the producer’s contract without checking existing consumers.