No. 05Architecture7 min read1,848 words
Replatforming a legacy web app: strategy, timeline, risks
How to replatform a legacy web app without a risky big-bang rewrite: rehost vs replatform vs rewrite, the strangler fig pattern, data migration and SEO.
- Written by
- Lazy Devs
- Published
- Updated
- Sources
- Cited inline

Key takeaways · 05
The short version
- 01Replatforming means keeping the product roughly the same while changing meaningful parts of the stack. It sits between rehosting (same code, new servers) and rewriting (starting over).
- 02Migrate incrementally with the strangler fig pattern: route specific paths to the new system, leave everything else on the old one, and move slice by slice while both stay live.
- 03Data migration is usually the biggest schedule risk. Write migration scripts early and run them repeatedly against a copy of real production data.
- 04Freeze scope during the move: replatform first, improve second. Feature parity creep is how a few months becomes a year.
- 05If the app has indexed public pages, keep URLs stable or map every old URL to its new one with a permanent redirect.
On this page · 10
Replatforming a legacy web app means moving it onto a modern stack while keeping the product roughly the same, and the safest way to do it is incrementally: route one part of the app at a time to the new system while the rest keeps running on the old one. It is mostly a risk-management exercise. The hard parts are usually the data, the undocumented integrations and the urge to add features mid-move, not the new code itself.
Most legacy web apps do not die. They get slow, expensive to change and scary to deploy, and then someone asks whether it is time to replatform. The decision is usually framed as technical, but the real questions are about money, risk, and how much movement your business can tolerate while the work happens. Here is how to think about it without being talked into a year-long rewrite you will regret.
Rehost, replatform, refactor or rewrite?
People use "replatforming" to mean several different things, and conflating them is where budgets go to die. AWS's guidance on migration strategies gives a useful vocabulary; here is how it maps to a typical web app.
| Approach | What changes | Effort and risk | Solves |
|---|---|---|---|
| Rehost | Same code, new infrastructure | Low | Hosting cost, reliability. Rarely the problems that prompted the move |
| Replatform | Some of the stack: front end framework, runtime, database, hosting model | Medium | Slow delivery, unsupported dependencies, poor performance |
| Refactor or re-architect | Internal structure, module boundaries, data model | Medium to high | Code that fights every change |
| Rewrite | Everything, from a blank repository | Highest | Only justified when the old system truly cannot be evolved |
Replatforming in the honest sense looks like swapping a jQuery or server-templated front end for React and Next.js, moving a PHP monolith's business logic into a TypeScript API, moving data into Postgres from an ageing database, or pulling business rules out of a 4,000-line controller.
Rewriting from scratch is the option people reach for emotionally because the old code feels unpleasant. Resist it unless the old system is genuinely unmaintainable, and be honest about whether "unmaintainable" really means "the original team left and nobody documented anything". That is a stalled project to rescue, not necessarily a platform to replace.
Choosing the target platform
Pick the destination for boring reasons: it is widely used, actively supported, easy to hire for, and fits what the product does. For most web products we move to TypeScript, React with Next.js, and Postgres, because each has a long support horizon and a large pool of engineers. If you are already on an older Next.js setup, the move may be smaller than you think; we cover that path in migrating to the App Router.
Avoid choosing a platform because it is new and exciting. A replatform is meant to buy you years of calm, and the newest option rarely has the track record to promise that. Content-heavy sites are a special case: moving off a page builder or a traditional CMS, such as a WordPress to Next.js migration, has its own concerns around editors, content models and URLs that deserve planning before any code is written.
Signs it is time to replatform
You probably need to act when several of these are true at once:
- The framework or runtime is past its supported life, so security fixes have stopped. Projects publish these dates; PHP and Node.js, for example, both list when each version loses support.
- Simple changes take weeks because every change breaks something else, a classic symptom of technical debt.
- You cannot hire people who want to work on the stack.
- Performance or Core Web Vitals are poor and the architecture makes them hard to fix.
- Deployments are manual, rare and frightening.
If only one is true, a targeted fix (an upgrade, a caching layer, a CI pipeline) may be enough.
Avoid the big-bang rewrite trap
The classic failure goes like this. The team decides the old app is beyond saving, freezes feature work, and starts building a fresh version in parallel. The business keeps needing changes, so the old app gets patched anyway. Now you maintain two systems, the rewrite keeps discovering edge cases nobody documented, and a year in you have a new app that does most, but not all, of what the old one did, and a sales team asking why nothing shipped.
The alternative is the strangler fig pattern, named after a vine that grows around a tree and gradually replaces it. Microsoft's architecture guide describes the same strangler fig approach: put a routing layer in front, send migrated functionality to the new system, and let everything else fall through to the old one until nothing is left.
How incremental migration works with Next.js
Next.js supports this directly. A fallback rewrite is checked only after all of the new app's own pages and routes, so any path the new app does not handle yet is proxied to the legacy system. The Next.js docs describe this as incremental adoption.
// next.config.ts
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
async rewrites() {
return {
// Checked after every page and route in the new app.
// Anything not migrated yet is served by the legacy system.
fallback: [
{
source: "/:path*",
destination: "https://legacy.example.com/:path*",
},
],
};
},
};
export default nextConfig;With this in place, migrating a section is as simple as building it in the new app: once app/dashboard exists, /dashboard is served by Next.js and everything else still reaches the old app. No routing changes per slice.
One trap to avoid: because fallback rewrites run after dynamic routes, a catch-all route in the new app (such as app/[...slug]/page.tsx) matches every path first, and the legacy system never gets a request. Keep the new app's routes specific until the migration is finished, and add any catch-all last.
Two practical details matter. Shared sessions: users must stay signed in as they cross between old and new pages, so plan how authentication cookies or tokens work across both from day one. Shared data: during the transition both systems often read and write the same database, so schema changes need to stay compatible with the old code until it is retired.
The process for each slice:
- Pick a slice with clear boundaries and real value (often a dashboard or account area, not the hardest workflow).
- Add characterisation tests that pin down how the old version behaves today, including its quirks.
- Build the slice in the new app against the same data.
- Release it to a small group, compare behaviour, then switch everyone over.
- Remove the old code for that slice so you are not maintaining both.
If something breaks, the blast radius is one feature, not the whole product. You can pause the project halfway and still have shipped real value, which a big-bang rewrite never can.
Data migration is the real schedule risk
The biggest risk is rarely the new code. It is years of accumulated, inconsistent, partially documented production data. Fields that mean different things depending on when the row was created. Dates stored as text. Orphaned records the old app quietly ignored.
- Profile the real data early, not a clean fixture.
- Write migration scripts as code, version them, and run them repeatedly against a recent copy of production.
- Make migrations idempotent so you can run them more than once safely.
- Reconcile counts and totals before and after; money and permissions deserve exact checks.
- Rehearse the final cutover, including how long it takes and how you would roll back.
Timelines and cost: what drives them
Anyone who quotes a firm timeline before seeing the code is guessing. As rough planning shapes from our own work: a front-end-only modernisation of a real product is usually measured in a few months; a full-stack incremental migration takes longer but ships value throughout; a ground-up rewrite of a mature app is the longest and has the widest error bars, because the old system always hides surprises.
| Driver | Why it adds effort |
|---|---|
| Number of screens and workflows | Each one needs rebuilding and testing |
| Data volume and messiness | Cleaning and mapping take longer than writing code |
| Integrations | Payment webhooks, exports and partner APIs each need re-wiring and testing |
| Missing tests | Behaviour has to be captured before it can be preserved |
| Lost knowledge | Without the original team, every odd decision needs investigating |
| Public, indexed pages | URL mapping, redirects and SEO checks |
The cheapest insurance is a short paid discovery phase, often one to two weeks, where an engineer reads the code, maps the data and integrations, and tells you what the real project looks like.
What to watch out for
No tests means no safety net. If the legacy app has no automated tests, the first real work is adding characterisation tests around behaviour you cannot afford to break.
Hidden integrations. The payment webhook, the nightly export to accounting, the report one large customer depends on. These never appear in the spec and always appear in production. Ask early who consumes data from the app.
Feature parity creep. "While we are in here" is how a few months becomes a year. Replatform first, improve second. Keep a separate backlog for new ideas.
The people who know why. Old code is full of odd decisions that were correct at the time. If the people who made them are still around, get that knowledge written down before they leave.
SEO and URLs. If your app has public, indexed pages, keep URLs stable or follow Google's guidance on site moves with URL changes, mapping every old URL to its new one with a permanent redirect. A replatform that quietly loses your rankings is a business problem dressed as a technical one. Our performance and SEO engineering work covers this.
A replatforming checklist
- Agree the goal: what business problem does this move solve?
- Choose rehost, replatform, refactor or rewrite deliberately, with reasons written down.
- Inventory every integration, scheduled job and data consumer.
- Add characterisation tests around critical behaviour.
- Plan shared authentication and data access across old and new systems.
- Migrate slice by slice behind a routing layer, removing old code as you go.
- Script and rehearse data migration against real data.
- Map and redirect every changed public URL.
- Freeze new features on unmigrated parts.
Ship value the whole way through
Replatforming a legacy web app is mostly risk management, not coding. Prefer incremental migration over the big bang, pay for a short discovery phase before committing serious money, treat data migration as the hard part it is, and protect the behaviour your business already depends on. Done that way, you ship value throughout and never bet the company on a single launch day.
This is the core of our migrations and replatforming work. If you want a second opinion on whether your app needs a rehost, a replatform or an honest rewrite, tell us about your system and we will give you a straight answer.
Changing URLs along the way? Work through our free site migration SEO checklist so rankings survive the move.
FAQ · 05 questions
Frequently asked questions
What is the difference between replatforming and refactoring?
Replatforming changes the platform an application runs on or is built with, such as moving from a legacy framework to a modern one, while keeping its behaviour roughly the same. Refactoring improves the internal structure of code without changing what it does, and can happen on any platform. A replatform usually involves a lot of refactoring along the way.
How long does it take to replatform a legacy web app?
It depends on the number of screens, the amount and messiness of the data, and the integrations involved. A front-end-only modernisation is typically measured in months, and a full-stack incremental migration takes longer but delivers value throughout. Any firm timeline given before someone has read the code and seen the data is a guess.
Is it better to rewrite or replatform a legacy app?
Replatforming incrementally is the safer default because it keeps the business running and ships value throughout. A rewrite fits only when the old system is genuinely unmaintainable, for example an unsupported framework that cannot be upgraded or a data model that fights every change.
Will replatforming hurt my SEO?
It can if URLs change without redirects, content or metadata is lost, or the new site is slower or harder to crawl. Keep URLs stable where you can, permanently redirect every old URL that changes, carry over titles and structured data, and monitor Search Console closely after launch.
Can we keep shipping new features during a replatform?
With an incremental approach, yes, though it is wise to limit new features to the parts already migrated. With a big-bang rewrite, feature work usually freezes or has to be built twice, which is one of the main reasons rewrites overrun.