Your API is used by a web app and an older mobile app that users do not update quickly. How do you make a breaking change safely?
What the interviewer wants to hear
- Prefer additive, backward compatible changes
- Version the API when a breaking change is unavoidable
- Run old and new versions side by side with a deprecation period
- Measure usage of the old version before removing it
- Contract tests or typed schemas to catch breaks early
Model answer
First I try to avoid a breaking change at all. Adding new optional fields or new endpoints is backward compatible, so old clients keep working. If I must change the meaning or shape of a field, I add the new field next to the old one and keep filling both for a while. When a real break is needed, I create a new version, for example /v2/orders or a version header, and run both versions side by side. I mark the old version as deprecated, tell client teams, and use logs or analytics to see which app versions still call it. For mobile, I can use a minimum supported version check to ask very old apps to update. Only when usage is near zero do I remove v1. I keep an OpenAPI schema or shared types and contract tests in CI so accidental breaking changes are caught before release.
Can you answer it under time pressure?
Take a timed medium round and get scored on every answer.
More medium Full Stack Developer questions
- How would you implement login for a web app? Compare server sessions with JWT access tokens and explain what you would choose.
- Users say the orders page is slow. How do you find and fix the problem across frontend, API and database?
- How would you build a feature that lets users upload profile photos and PDF documents up to 100 MB?
- Describe a good CI/CD pipeline for a full stack app. What runs on each pull request and how do you deploy safely?
- You need to build a product search page with text search, filters and sorting. Walk through the design from the UI to the database.
- How would you add role-based access control (admin, editor, viewer) to an existing full-stack app?
- What is your testing strategy for a full-stack feature such as "invite a teammate by email"?
- Describe the different layers where you can cache in a typical full-stack web app, and how you keep cached data correct.
- You need to show in-app notifications in real time. How do you choose between polling, server-sent events and WebSockets, and how would you build it?