When should you migrate a legacy system instead of maintaining it?
Migrate when the cost of maintenance and change grows faster than the value the system delivers, when the stack no longer receives security updates, when few people can work on the code, or when it blocks integrations. A stable, rarely changed and well-isolated system is often cheaper to keep and wrap with an API.
Base the decision on concrete signals. Security risk comes first: an unsupported operating system, database or framework means vulnerabilities nobody will patch. Next is people risk: if one developer leaving would freeze all changes, you have a problem regardless of code quality. Then there is opportunity cost, meaning the projects you cannot start because the old system will not integrate with your store, CRM or AI tools.
On the other hand, not every old system needs rewriting. An accounting module that has calculated correctly for years and rarely changes can stay put, surrounded by a modern API while the rest of the functionality moves around it. An honest assessment often concludes that two areas out of five need migrating, not the whole thing.


