How would you engineer this:

You have a legacy application that is a big ball of mud and a monolith. This application is "impossible" to change to look good on mobile devices.

The management is pushing to make it mobile friendly and more graphical appealing and to modernize it. Therefore a new frontend is needed that lives outside the monolith.

But where should the new frontend make request to perform business logic?

1. Create an api inside the monolith that is serving data to the outside when authenticated


  • Only 1 backend app. Simpler for debugging and deploying etc. Most of the code that the new frontend needs does already exist in the monolith.


  • Continues to develop a legacy application that needs to be modernized itself. With for example refactoring or to strangle it and writing new code.

2. Create a new application with shared database


  • Can make use of new frameworks and the latest version of PHP (or another language).


  • Another backend app to maintain.
  • Another backend app that can possibly corrupt data in database.
  • Code duplication. The code will probably be very similar to the already existing code in monolith.
  • Still stuck with the legacy database

3. Create a new application with new database


  • Can make use of new frameworks and the latest version of PHP (or another language).
  • The database schema is designed with the needs of the new frontend.


  • Another backend app to maintain.
  • Data synchronization. This is gonna need a lot of data from the legacy database because their domain is still the same.

What would you do? Which of the options above? Or another solution? What design patterns would you use with the chosen solution?

There is gonna be a small team working on this, 1-5 developers only.

  • 3
    I don't think anyone outside your company can answer this question for you, only people close to the code can weigh up and advantages and disadvantages of each approach. Mar 2, 2021 at 12:59
  • So the old application has already a frontend. What is the intention with this - to replace it fully by the mobile version, or to keep the mobile and non-mobile versions both alive in parallel?
    – Doc Brown
    Mar 2, 2021 at 13:28
  • @DocBrown Yes, it has. The dream is to replace it with the mobile version. But for now, it will only be used for the most important features so they can be used on mobiles. But they would at least be runned in parallel for some years because it will take that much time to migrate over all the features.
    – emajl
    Mar 2, 2021 at 13:36
  • 3
    If both frontends will be required for controlling backend functionality which must be identical, and both will be maintained over years, you definitely don't want to maintain two code bases for two backends with heavily overlapping functionality. Situation could be different if the new backend would sooner or later replace the old one, but I guess that's not realistic.
    – Doc Brown
    Mar 2, 2021 at 14:15
  • 2

1 Answer 1


From my experience you should NEVER try to recode something existing if it does not have good specifications and test.

Trying too create a new app always seems good at first glance (working with new technologies, stop using dirty legacy code...) But at the end you always end up having trouble understanding how certain things works on the existing app because the big ball of mud became kind of magic after a lot of people added stuff on it and you end up with something far worse than you had at the beginning.

For me the only real solution is to refactor the big ball of mud step by step to make something clean out of it.

But in the end it really depends, on the complexity of the existing project, the time you have to develop the new version...

  • Yes. Agree. Before I was sure to strangle the big ball of mud and migrating the functionality to something new. But now im starting to think that a refactor is simpler and faster. Another bad part is that our framework is "dead" and do not get any security updates anymore. So... Your suggestion is to implement this new "backend api" in the big ball of mud? The only new in the big ball of mud would be the authentication part.
    – emajl
    Mar 2, 2021 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.