All jobs / Solutions / cloud architect / Application Architecture
Solutions / cloud architect interview question · 0–1 years
What does designing an API “contract-first” mean, and why do teams do it?
The strongest answer
You write and review the interface specification before the implementation, so consumers can build against mocks in parallel and the contract is a deliberate design rather than whatever the code happened to expose
Why it works
Exactly — the contract is the product; code follows it and both sides work at once.
What a good answer covers
- The contract comes first.
- Spec, review, then code.
- Consumers build against mocks.
- Design the shape deliberately.
Answers that fall short
- Close, but not the strongest: You write the API documentation before releasing the API to consumers
Documentation after the fact is not a contract; the design conversation has already happened by then. - Weak: You generate the specification from the code once the implementation is finished
Generating from code is code-first; the shape is decided by the implementation. - Red flag: You let the first consumer define the endpoints they need
One consumer’s needs make a poor contract for the second consumer.
Who gets asked this
More Application Architecture questions
- What does an API gateway do for you, and what should you resist putting in it?
- A client retries a “create payment” request after a timeout. How does the design stop a double charge?
- How do you version a public API so you can change it without breaking customers?
- Two services both need customer data. Who owns it, and how does the other get it?
- How do you keep a monolith modular enough that you could split it into services later?
- Booking a trip touches flights, hotel and payment services. How do you keep them consistent?
- How do you replace a large legacy system without a big-bang cut-over?
- When does separating read and write models earn its complexity, and when does it not?