Ryz Labs/Migrations/AngularJS to React
Migrations

AngularJS to React and Next.js: A Migration Runbook

A route-by-route plan for retiring AngularJS 1.x: a reverse-proxy strangler, component bridges, service replacement and a cutover you can roll back.

Migrating AngularJS 1.x to React means replacing a digest-cycle framework that no longer gets security fixes with React components served by Next.js. Do it as a strangler fig: put a reverse proxy in front, ship new routes in Next.js, bridge shared widgets with react2angular or angular2react, and retire AngularJS one route at a time. Success depends on one thing: pulling the business logic out of $scope, $rootScope and injected services before you port the views, because that hidden state is what breaks.

Why teams migrate now

The AngularJS project states that "AngularJS support has officially ended as of January 2022." There is no long-term support line and no upstream security patch stream. Every vulnerability found in the framework, or in the plugins that wrap it (ui-bootstrap, angular-translate, ng-file-upload and the long tail of directives), is now yours to patch or live with.

The target is mature and moving. React 19 shipped as stable on December 5, 2024, and the current release is React 19.3.0, from September 9, 2026. On the framework side, Next.js is on major version 16, with 16.4 released October 6, 2026. The App Router has been stable since Next.js 13.4 in May 2023, and the Next.js team says the Pages Router stays supported and that running both routers in one app is supported and encouraged. That matters for a strangler plan: you can land routes in whichever router fits and converge later.

The business consequences are concrete. Security reviews and pen tests flag an end-of-life frontend framework as a finding that needs a compensating control or a remediation date. Third-party AngularJS modules stop getting releases, so a browser change or a dependency CVE can leave you with no upgrade path. Engineers who know the digest cycle, $compile and transclusion well are getting harder to hire, and new hires spend weeks learning patterns they will never use again. And a client-rendered AngularJS shell hands crawlers an empty page with a pile of templates, which hurts public and marketing routes that need to rank.

Before you start: inventory and baseline

AngularJS hides coupling where a dependency graph cannot see it. Map it first.

The strangler-fig plan, phase by phase

Phase 0: Freeze the shape of the legacy app

Stop adding new AngularJS surface. New features go into React from here on, even if that means a small bridged component inside an old screen. If you are not on the last published 1.x release, get there first and read its changelog for changed defaults, so those surprises are behind you before a second framework arrives. Convert remaining controllerAs-less controllers and directives to .component() with one-way bindings where cheap, because components map almost one to one onto React function components.

Exit criteria: characterization suite green on the legacy app in CI, route inventory approved, no new AngularJS code merged.

Phase 1: Stand up the Next.js shell behind a reverse proxy

Create the Next.js app in the same repo or a sibling one, with TypeScript, your design tokens and a shared layout (header, nav, footer) rebuilt in React. Put a reverse proxy in front of both apps: nginx, Envoy, CloudFront behaviors or your load balancer's path rules. The simplest version uses Next.js itself as the front door, with a rewrites fallback rule that sends any path Next.js does not handle to the AngularJS origin. Either way, keep both apps on the same domain so session cookies, CSRF tokens and local storage are shared.

Ship one low-risk route first: a settings page or a read-only report. AngularJS uses hash-bang or HTML5 mode URLs; if you are on hash URLs (#!/orders/42), add a small client-side redirect so old bookmarks land on the new clean paths.

Exit criteria: one production route served by Next.js, proxy config in version control, per-route switch documented, rollback by config change tested.

Phase 2: Replace services and the HTTP layer

This is the phase most teams skip and regret. AngularJS services are singletons owned by the injector; React has no injector. Port stateless API services into plain TypeScript modules, and put server state behind a data-fetching layer such as TanStack Query or SWR so caching and refetch are explicit rather than a side effect of a digest. Re-implement every $http interceptor as a fetch wrapper: same auth header, same refresh-on-401, same error toast.

Stateful services (current user, feature flags, cart) need a single source of truth while both apps run. Options: move the state server-side and have both apps read it via API; or keep the AngularJS service as the owner and let React read it through angular.element(document.body).injector().get('UserService') plus a subscription, only as a temporary bridge. Replace $rootScope events with an explicit event emitter or a small store (Zustand or Redux Toolkit) that the AngularJS side publishes into.

Exit criteria: no React code calls $http, every interceptor behavior has a test, and stateful services have one named owner.

Phase 3: Migrate leaf components with bridges

Inside screens that are not ready to move whole, swap leaf widgets first: date pickers, tables, charts, form fields. react2angular wraps a React component as an AngularJS component so an old template can render it; angular2react goes the other way and lets a React route reuse an AngularJS directive you have not rewritten yet. Pass data down with one-way bindings and callbacks up; never hand a React component a mutable object that AngularJS will change in a digest, because React will not see the mutation and will render stale data.

Two-way binding is the trap here. An ng-model on an isolate-scope '=' binding silently writes back to a parent; in React that has to become an explicit value plus onChange. Audit every '=' binding you cross. When a React callback updates AngularJS state, wrap it in $scope.$applyAsync or the change will not render until something else triggers a digest.

Exit criteria: bridged components covered by the characterization suite, no '=' bindings crossing the bridge, digest count per interaction not increasing.

Phase 4: Move routes, state by state

Now move whole UI-Router states to Next.js routes. The mapping is mostly mechanical once services are gone:

Move public and SEO-relevant routes early. Server rendering in Next.js gives crawlers real HTML, real titles and real meta tags, which AngularJS never did without a prerender service.

Exit criteria per route: characterization tests pass against the Next.js version, error rate and p95 within the Phase 0 baseline, analytics events identical, proxy rule flipped.

Phase 5: Decommission AngularJS

When the last state moves, delete the proxy fallback, the bridges, the injector shim, the AngularJS bundle and its Karma or Jasmine suites. Remove angular, angular-ui-router and every ng- plugin from the lockfile so dependency scanners stop flagging them.

Exit criteria: zero requests to the legacy origin over an agreed observation window, AngularJS absent from the dependency tree, security finding closed.

PhaseGoalKey techniqueExit criteria
0. FreezeStop growth of legacy surfaceMove to last 1.x release, convert to .component(), Playwright characterization suiteSuite green, inventory approved, no new AngularJS merges
1. ShellNext.js in production on one routeReverse proxy or Next.js rewrites fallback, same domain, shared cookiesOne route live, rollback by config tested
2. ServicesRemove the injector as a dependencyPlain TS modules, TanStack Query or SWR, fetch wrapper for interceptors, store for $rootScope eventsNo React code on $http, single owner per stateful service
3. BridgesReplace leaf widgets inside old screensreact2angular and angular2react, one-way props, $applyAsync on callbacksNo '=' bindings across the bridge, tests green
4. RoutesMove UI-Router states to Next.jsLayouts for nested states, server data for resolves, middleware for guardsPer-route parity on errors, p95, analytics
5. DecommissionRemove AngularJS entirelyDelete fallback, bridges, bundle and legacy testsZero legacy traffic, dependency scan clean

Cutover and rollback

Traffic moves by path, not by DNS. The proxy (or the Next.js rewrites table) is the switchboard: each route group has a rule that points at either the Next.js app or the AngularJS origin. Version that table and deploy it apart from both apps, so rollback needs no frontend build.

For high-traffic routes, add a feature flag in front of the path rule: a cookie or header-based split (LaunchDarkly, Unleash, or a homegrown flag) sends internal users first, then a small share of real users, then everyone. Because both versions call the same backend APIs, there is no data migration and no dual write; the risk is behavior, not data.

Compare outputs before widening. Run the characterization suite against both versions of the route on every deploy, and diff the analytics event stream (event names, properties, order) between the two variants for the same flows. A missing "checkout_started" event is a regression even if the screen looks right.

Go/no-go checklist for each route:

Rollback path by phase:

Risk matrix

RiskLikelihoodImpactMitigationEarly warning signal
Hidden state in $rootScope or a shared service is lost when one screen movesHighHighInventory $broadcast/$on and stateful services; move state server-side or into one store before porting viewsValues reset when navigating between an old and a new route
Two-way '=' bindings write back to parents that React never updatesHighMediumAudit every isolate binding crossing a bridge; replace with value plus onChangeStale form values or saves that send old data
React callback changes AngularJS state outside a digestMediumMediumWrap bridge callbacks in $applyAsync; test each bridged interactionUI updates only after an unrelated click
$http interceptor behavior not reproduced in fetch wrapperMediumHighPort interceptors first, with tests for refresh, 401 and error pathsSpike in 401s or silent logouts on new routes
Two framework bundles on one page hurt load timeMediumMediumKeep bridges temporary; prefer whole-route moves; track bundle size per route in CIp95 load time on bridged screens drifting up
UI-Router resolves and guards dropped during route mappingMediumHighMap each resolve and onBefore hook to server data or middleware explicitly in the route ticketUnauthenticated users reaching protected pages in staging
Proxy rules drift between environmentsMediumHighSingle routing table in version control, deployed to all environments the same wayRoute served by different apps in staging and production
Filter and formatting differences (dates, currency, translations)HighLowPort filters as shared functions with snapshot tests against legacy outputVisual diffs or support tickets about wrong formats
Feature work keeps landing in AngularJSMediumMediumLint or CI rule blocking new .directive() and .controller() callsLegacy file count stops falling

Typical team shape

An AngularJS exit needs people who can read the old app fluently and build the new one well. A typical shape:

Many teams begin with a pod of 3 to 5 senior engineers (a tech lead plus engineers), and a full pod is about seven. Ryz engineers on your team start from $7,000 per month (our published range is $7,000–$15,000 per engineer per month, mostly mid-level to senior), quoted per team. Project cost = team size × months × monthly rate, and the months depend on route count and how much logic sits in services. Ryz engineers work on your team, reporting to your leads. Once you say go, engineers can typically start in under two weeks. Scope your team and we will come back with a plan, a price and named engineers.

Where an AI pod helps (and where it doesn't)

A lot of AngularJS migration work is repetitive translation, and that is where AI-assisted tooling earns its place. Our AI pod uses coding assistants to:

Where it does not help: deciding who owns shared state, choosing which routes move first, and judging whether a subtle digest-timing behavior is a bug users depend on. A drafted component that looks right can still drop a watcher side effect. Every change goes through human review and has to pass the same characterization tests as hand-written code.

When not to migrate (yet)

And if you want a freelance marketplace with hourly gigs for a few isolated tickets, a dedicated Ryz team is not the right fit.

Related

FAQ

How long does an AngularJS to React migration take?

It depends on the number of UI-Router states, how much business logic lives in services and $rootScope events, how many directives use transclusion or $compile, and how much test coverage exists today. Teams that extract services first and move whole routes tend to move faster than teams that bridge widgets for a long time, because two framework runtimes on one page slow everything down.

Can AngularJS and React run in the same app during the migration?

Yes, at two levels. A reverse proxy or Next.js rewrites fallback lets each route be served by either app on the same domain, and react2angular or angular2react bridges let a single screen mix components from both. Keep the bridges short-lived and prefer route-level moves, since every bridged screen loads both runtimes.

Should we go to Angular instead of React?

Modern Angular is a different framework from AngularJS, so either way you are rewriting views. Choose based on your team's skills, your hiring pool and how much you want server rendering; React with Next.js gives you server rendering per route, which matters for public pages that need to rank.

Do we need to freeze feature work?

No, but new features should be built in React from the start, either as a new Next.js route or as a bridged component inside an old screen. A CI rule that blocks new AngularJS directives and controllers keeps the legacy surface shrinking while the roadmap continues.

What does an AngularJS migration cost?

Project cost is team size times months times the monthly rate per engineer. Ryz quotes per team after looking at your route inventory, services and test coverage, so the main levers are how many states you have and how tangled the shared state is, not the line count of the templates.

Questions we didn't answer? Email info@ryzlabs.com.

Thanks — your message has been sent. We’ll get back to you soon.

Something went wrong while sending your message. Please try again or email info@ryzlabs.com.

Explore Ryz Labs

Software development servicesAI development companyIndustriesStaff augmentationAI pod teamsNearshore software developmentHire engineers by roleEngineer ratesGuidesBuyer guidesCase studiesHow we vet engineers

Ryz Labs

Senior engineers on your team. AI pod teams that ship.

Tell us what you're building. You get a scoped plan, a price and the names of the people who would do the work.

  • Only the top 1% of tens of thousands interviewed make it
  • On US business hours, including New York hours
  • Trusted by Fortune 500 engineering teams

Tell us who you need

A Ryz partner replies with a scoped team plan.

Start a conversation →

Prefer to talk? Book a 15-min call →