← All posts
Nov 18, 2026 · 9 min read

Two Legacy Migrations and What I'd Do Differently

A .NET API on Task Scheduler became an Express service with a real cron, and Angular 8 became Angular 15. What went wrong and what I would do differently.

#migration#angular#nodejs#engineering
--

I have worked on two legacy migrations. One was a .NET API that leaned on Windows Task Scheduler as its cron job, rebuilt as an Express.js service with a real scheduler. The other was bringing AngularJS and Angular 8 apps up to Angular 15. Both were initiatives driven by my department, and I was part of the team that carried them out. They taught me the same thing: the safe migration is the boring one.

Why migrate at all

Legacy code rarely fails loudly. It gets harder to change, slower to ship, and a little more risky every quarter. Old dependencies that can no longer be upgraded are also the ones that tend to show up in security scans, and nobody wants to explain an unpatchable finding twice. The case for migrating is usually maintainability and delivery speed, not novelty.

The clearest recent example is PHP. In October 2026 two critical flaws, CVE-2026-109618 and CVE-2026-109619, were disclosed and then exploited in the wild. Supported branches (8.2 to 8.5) received fixed releases. End-of-life branches did not: PHP 5.4 to 7.3 got nothing from the PHP project, and the newer retired branches got no regular release, at best a minimal source backport. A system still running an unsupported PHP has no easy patch. Its fix is a migration, and the longer it has been left, the bigger that migration is. A migration forced by an incident is the most expensive kind.

Migration 1
A .NET API with Windows Task Scheduler as its cron job, rebuilt as an Express.js service with proper cron.
Migration 2
AngularJS and Angular 8 apps brought up to Angular 15, one version at a time.

Migration 1: from Task Scheduler to a real cron

Task Scheduler is fine until you need to know what it did. The schedule lives on one server, outside the code, so it is not reviewed in pull requests and not versioned with the app. Overlapping runs, failures nobody sees and logs scattered across machines are the usual problems. Moving the schedule into the service itself means jobs are code: reviewed, tested, logged in one place, and deployed with the rest of the app.

Where it went wrong: translating by hand

My first approach was to translate the .NET code into JavaScript by hand, line by line. In hindsight that was a bad idea. The syntax is the easy part. What does not carry over is the set of concepts .NET gives you for free and JavaScript does not.

In .NETIn JavaScriptWhat to check
Static typing, compile-time checksDynamic by defaultAdd TypeScript or validate input at the boundary
decimal for moneyNumbers are floating pointUse integers for cents or a decimal library
async Task and awaitPromisesUnhandled rejections and missing awaits fail quietly
LINQArray methodsEvaluation is eager, so large result sets cost more
DateTime and time zonesDateDecide on UTC everywhere and convert at the edges
Built-in dependency injectionNothing built inPick one pattern for wiring services and stick to it
Attribute-based validationNothing built inUse a schema validator on every request body

What I would do instead

Port behavior, not syntax. The old API is the specification, so treat it that way.

  1. 01Write down what it doesList every endpoint, every scheduled job and every side effect before touching code. Jobs are the part people forget.
  2. 02Capture real responsesRecord what the old API returns for real requests. Those become the checks the new service has to pass.
  3. 03Move one piece at a timePort one endpoint or one job, keep the same contract, and compare the two side by side.
  4. 04Put the schedule in codeDefine jobs in the service, guard against overlapping runs, log start, finish and failure, and make failures visible.
  5. 05Cut over, then retireSwitch traffic and schedules when the numbers match, and only then turn the old one off.

Migration 2: Angular 8 to Angular 15

The hardest part was not Angular itself. It was dependencies. As I went up, some third-party packages stopped supporting the Angular version I was on, or had not caught up with the next one. Angular's own tooling does a lot of the work for you. Your dependencies do not come with that help.

The lesson

Going up one major version at a time and testing in between is much better than jumping from 8 to 15 in one go.

  1. 01Check the dependencies firstList every package and check which Angular versions it supports before you start. The ones with no upgrade path decide your timeline.
  2. 02Read the update guideFor each step, read what changes between your version and the next so nothing surprises you.
  3. 03Run ng update for one majorUpdate the framework and CLI, let the migrations run, then fix what they flag.
  4. 04Fix or replace what brokeUpgrade the package, replace it, or remove it. A dependency you can drop is the cheapest fix.
  5. 05Build, test, commit, repeatEvery version ends with a working build and passing tests. If something breaks, you know exactly which step caused it.

One reason this matters is that some jumps change the rules for everything underneath. Angular 9 made Ivy the default, and Angular 13 dropped the old ViewEngine, so libraries had to ship for Ivy. If you take those steps one at a time, you find the broken package at the step that broke it.

AngularJS is a different animal

Moving from AngularJS to modern Angular is not an upgrade in the same sense. There is no single command that carries you across, because the two frameworks are built differently. Plan it as a gradual rewrite, screen by screen, or run both side by side while you move, and set the end date for removing AngularJS up front.

What both migrations had in common

Small steps
Each step is small enough to test and to undo.
Tests before changes
Without a baseline you cannot tell a regression from a difference.
Dependencies decide the pace
The framework upgrade is rarely the blocker. The packages around it are.
Do not translate line by line
Port behavior, not syntax, and let the old system be your specification.
The takeaway

The fastest migration is the one you can ship in small, boring, reversible steps.

Next postDebounce vs Throttle, Explained With Code
Book a call
patr1ck@dev — zsh
patr1ck.dev shell — type `help` to begin.
❯