As a front end developer, I feel frustrated every time the back end crashes, stops responding to the APIs or makes the front end crash when an API doesn't honor its contract because of missing data. Every time something like this happens, I get thrown off and I don't know what to do.

Creating mock responses and then working on it seems viable to some extent but what am I supposed to do when this happens all the time? Should I keep making mocks?

  • 7
    Who is responsible for the back end and APIs? Is there a bug reporting process or a way to get support from that team? What tools do you have to make mocks? Is there deliberate separation between front end and back end development or are you expected to actually use the back end to do your development?
    – dwizum
    Commented Feb 13, 2020 at 16:16
  • 2
    Defensive Programming, Anti-corruption layer, and in general, wrap the backend into something that's resilient and designed to handle unexpected issues. That's what you do :)
    – STT LCU
    Commented Feb 13, 2020 at 16:34
  • 1
    Two issues here: 1.- what to do in case it happens in production, 2.- how to deal with a backend still in development.
    – UserMach2
    Commented Feb 14, 2020 at 0:39

5 Answers 5


Should I keep making mocks?

Yes, keep making mock functions to test what you're doing. Don't think of this as a waste of time you have to do because the back-end crashes, think of it as invaluable testing for your work. Unit tests save massive amounts of time on code maintenance: when something breaks down the road, you can run against your mock code and verify that your inputs are correct.

Logging is another great way to deal with this: make your code able to record exactly what you're passing to the back-end and verify that it is correct. Both of these are valuable going forward and will help with your current predicament.

  • 2
    As a developer who worked on both frontend and backend, Yes this is the correct way to do. Sometimes, the API will not be ready when we start working on frontend. Always start with the mock. Once its complete, switch to the actual API. Mock is very valuable in testing too. Commented Feb 14, 2020 at 0:03
  • @Mars I'm not sure I understand what you're saying. The front-end developer should know what the front end is supposed to do and should be capable of writing simple tests verifying that such is the case.
    – dbeer
    Commented Feb 14, 2020 at 16:10
  • Oops, yeah, my comment doesn't make sense at all. I'll delete it
    – Mars
    Commented Feb 16, 2020 at 15:42

Perhaps you can produce logs in your (debug) frontend environment that show the precise, quantifiable ways the APIs fail to honor the contract:

  • How often?
  • On which API methods? Do all of them fail or are maybe some of them buggy?
  • Under which circumstances? Is there particular input data on which the failures happen?

If the backend is run by another team/department in your company, this gives you something solid to discuss with them (or that can be raised by your team lead). Having actual quantitative data makes your concerns more valid in the eyes of a lot of people. And the logs will be helpful for the backend team in diagnosing the causes.

If the API backends belong to an external service, you can still raise a ticket with them. If that doesn't pan out, the data gives you something on which to base decisions of whether you want to keep using that API, or maybe avoid specific functionality.


I assume you are working with a back-end developer that is building out the API at the same time you're building the front-end?

If this is correct, then let them know of the issues and how its affecting you. If it continues you raise this with the manager.

You shouldn't have to put up with this repeatedly. The back-end should only be releasing sections of the API to you after it's fully tested and working.

Also, an API should never crash your front-end. Your front-end should always fail gracefully.


Creating mock responses and then working on it seems viable to some extent but what am I supposed to do when this happens all the time? Should I keep making mocks?

This is a case where you should consult with your manager or leader what to do, and how to handle this situation when it arises.

You can propose a course of action when consulting with your manager (like keep making mocks), and work on from that.


Because most likely the data model is in constant flux, mock responses could mean you are building a front end to a data model that won't exist in a couple of months and refactoring will be a pain. My suggestion is to sit with the backend dev and try to advance the shared data model as far as you can together, pair programming and lock it down for a minimum period. I code both the front end and back end and any model changes are a real pain, so I know exactly what you are experiencing as I am doing it constantly to myself

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .