I am a...
Learn more
How it worksPricingFAQ
Account
May 19, 2026 · 10 min read · Cadence Editorial

Cost to migrate from PHP to Node.js

cost to migrate php to nodejs — Cost to migrate from PHP to Node.js
Photo by [luis gomes](https://www.pexels.com/@luis-gomes-166706) on [Pexels](https://www.pexels.com/photo/close-up-photo-of-programming-of-codes-546819/)

Cost to migrate from PHP to Node.js

Migrating from PHP to Node.js in 2026 typically costs $40,000 to $500,000 depending on the pattern you choose. A small API-only re-platform runs $40k to $150k, a route-by-route strangler-fig migration runs $80k to $300k over 6 to 12 months, and a full rewrite of a complex monolith runs $150k to $500k. Most teams should not migrate at all.

The honest answer to "should we move off PHP" in 2026 is "probably not, unless you have a specific reason." Laravel 11 and modern PHP 8.3 are fast, well-supported, and shipping new features for years to come. If you are migrating because Node.js feels more modern, you are about to spend six figures on a vibe.

When you should actually migrate

There are real reasons to move. There are also fake ones. Be honest about which you have before signing anyone's invoice.

Good reasons to migrate:

  • You need long-lived WebSocket or SSE connections for real-time features and your PHP setup (FPM + workers) makes that operationally painful.
  • Your engineering team is now mostly TypeScript and your PHP codebase has one or two maintainers left who keep getting paged.
  • You are consolidating on a single language across frontend and backend to share validation schemas, types, and tooling (Zod, tRPC, Next.js server actions).
  • You want to deploy to edge runtimes (Vercel, Cloudflare Workers) where PHP is not a first-class citizen.

Bad reasons to migrate:

  • "PHP is old." So is C, and your operating system is written in it.
  • "Node.js is faster." For most CRUD apps, the bottleneck is your database, not your language runtime.
  • A new VP of Engineering wants to rebuild the stack. This is the most expensive vibe in tech.
  • You read a hot take on Hacker News.

If your reason is in the second bucket, stop reading and go ship a feature. If it is in the first, the rest of this post is for you.

The three migration patterns and what they cost

There are three ways to migrate, and the cost difference between them is roughly 10x from cheapest to most expensive. Picking the right pattern matters more than picking the right framework.

PatternCostTimelineBest forRisk
Full rewrite$150k to $500k4 to 12 monthsSmall apps, end-of-life PHP versions, hard schema changesHigh. Two codebases to maintain mid-flight.
Strangler-fig (route-by-route)$80k to $300k6 to 12 monthsMature apps with traffic, can't afford a freezeMedium. Slow but safe.
API-only re-platform$40k to $150k2 to 5 monthsApps where the frontend is already a separate SPALow. Smallest blast radius.

The numbers above assume you book engineering through an on-demand marketplace at mid-to-senior rates. Agency quotes for the same scope land 2-3x higher. Big-4 consultancies will quote 5-10x higher and deliver the same thing six months later.

Pattern 1: Full rewrite ($150k to $500k)

You start a green-field Node.js project, port features over in priority order, and cut over in one switch when the new app reaches parity. The old codebase goes into maintenance mode the day you start.

This works for small apps (under 30k lines of PHP) or apps where the data model is changing anyway. It does not work for apps with 200+ database tables, custom business logic accumulated over a decade, or anything regulated.

A realistic cost breakdown at this scale:

  • 1 lead engineer for architecture and cutover planning: 16 weeks at $2,000 = $32,000
  • 2 senior engineers for core feature port: 20 weeks each at $1,500 = $60,000
  • 1 mid engineer for test coverage and data migration scripts: 16 weeks at $1,000 = $16,000
  • Plus 25% buffer for unknowns (and there are always unknowns): ~$27,000

Total: $135,000 on the low end. Add another $100k to $300k if your PHP app has 5+ years of legacy code, heavy use of stored procedures, or custom payment logic.

Most full rewrites also blow their timelines by 50% to 100%. Budget accordingly.

Pattern 2: Strangler-fig route-by-route ($80k to $300k)

Named after Martin Fowler's pattern, the strangler-fig wraps your existing PHP app behind a reverse proxy (nginx, Caddy, or a small Node.js gateway). New endpoints get built in Node.js. Old endpoints get migrated one at a time. The proxy decides where each request goes.

This is the right choice for any production app with active users. You ship the migration in slices, each one independently shippable and rollback-able. There is no big-bang cutover.

The work breaks down like this:

  1. Build the routing layer. 2 to 4 weeks of senior work to set up a reverse proxy, share auth between the two services, and handle session continuity. This is the highest-risk part of the project.
  2. Port routes in priority order. Usually 1 to 3 routes per engineer per sprint, depending on complexity. Read-heavy GET endpoints are cheap. Anything with file uploads, payments, or background jobs is expensive.
  3. Maintain both stacks. During the migration, you have two codebases. Bug fixes get applied to both until each route is fully migrated.

A typical 6-month strangler-fig with 2 senior engineers and 1 mid engineer runs $130k to $180k. Bigger apps with 100+ routes can stretch to 12 months and $300k.

The trap with strangler-fig is that teams stop halfway. The project becomes "we are partially on Node.js" forever, which is operationally worse than either pure stack. Plan the full completion before you start, or do not start.

Pattern 3: API-only re-platform ($40k to $150k)

If your PHP app is mainly a JSON API that talks to a React or Vue SPA, you have the cheapest migration on the menu. You rewrite the API in Node.js (typically Fastify, Hono, or NestJS), keep the same database, and switch the SPA's API base URL.

This works because the contract is already defined. You are not redesigning anything. You are rewriting the same OpenAPI spec in a different language.

A realistic cost breakdown:

  • 1 senior engineer to scaffold the new API and port auth: 4 weeks at $1,500 = $6,000
  • 1 senior + 1 mid engineer to port endpoints: 8 to 12 weeks at $2,500/week combined = $20,000 to $30,000
  • 1 mid engineer for parity testing and gradual rollout (5% → 50% → 100%): 4 weeks at $1,000 = $4,000

Total: $30,000 to $40,000 for a small-to-medium API (50 to 100 endpoints). Larger surfaces push toward $100k. The pricing for other migration projects like MySQL to Postgres follows a similar engineer-hour calculation.

Common gotchas (the part where projects die)

The cost overruns on PHP-to-Node.js migrations almost always come from the same five places. Budget for them up front or get surprised later.

ORM differences

Eloquent (Laravel) and Doctrine (Symfony) are mature, opinionated ORMs. Prisma, Drizzle, and TypeORM each do things differently. Your PHP code that uses $user->orders()->whereHas('items', ...) does not have a one-line equivalent. Expect to redesign 20-30% of your data access layer, not just translate it.

Worst case: you have raw SQL embedded in PHP strings that depends on MySQL-specific functions. Each one needs to be ported and tested.

Session handling

PHP's $_SESSION is server-side, file-backed by default, and "just works." Node.js has no built-in session store. You have to pick one (Redis, Postgres, a JWT, a signed cookie) and deal with the consequences.

If your PHP app uses session_regenerate_id() for security, the Node.js equivalent is several lines of code per route. If you have CSRF protection via Laravel's middleware, you need to rebuild that with a library like csurf or move to SameSite cookies plus a custom-header check.

File system assumptions

PHP scripts often write to local disk: cached views in storage/framework/views, uploaded files in public/uploads, queue payloads in storage/app. On a single VPS, this works. In a containerized Node.js deployment, it does not.

Plan to move every file-system write to S3-compatible storage (S3, R2, Backblaze) before you migrate. Otherwise, you will discover the problem at 3am after a deployment.

Long-running requests and background jobs

PHP-FPM kills requests after max_execution_time (default 30 seconds). Node.js does not have this safety net. A bug that would have been a 500 error in PHP becomes a memory leak in Node.js.

If you use Laravel queues, you will need to rebuild your workers in BullMQ, Inngest, or Trigger.dev. The cost of the queue runtime itself is usually under $50/month, but the engineering time to migrate jobs is real.

Error handling and type coercion

PHP's == and null coercion are forgiving. TypeScript's strict mode is not. Code that "worked" in PHP will reveal latent bugs in Node.js. This is good in the long run, painful in the short.

When you should NOT migrate

Repeat after me: PHP Laravel is fine in 2026. So is Symfony. So is even WordPress for content sites. The PHP that runs Facebook, Slack, and Etsy is the same language you are running, with newer syntax.

If you are migrating because of one of these reasons, stop:

  • Your CTO read a blog post.
  • You want to look modern when raising a Series A.
  • Your engineering team is bored.
  • You think Node.js is "faster" without having measured anything.

Pick a different fight. Improve your PHP test coverage, upgrade to PHP 8.3, add Pest or PHPUnit, deploy with Forge or Ploi. You will get 80% of the benefit at 1% of the cost.

How to reduce migration costs without cutting corners

The teams that ship migrations under budget tend to do the same five things:

  • Start with the API-only pattern if possible. It is always cheaper to migrate one layer than the whole stack. This is the same logic that makes the admin dashboard build pattern so much cheaper than a full app rebuild.
  • Use AI-native engineers. Porting PHP routes to Node.js is exactly the kind of repetitive translation work where Cursor and Claude Code shine. An AI-native senior can port 2-3x faster than someone hand-typing every conversion. Every engineer on Cadence is AI-native by default, vetted on Cursor / Claude / Copilot fluency before they unlock bookings.
  • Pick boring frameworks. Fastify and NestJS are well-documented, have large communities, and translate cleanly from Laravel patterns. Choosing a niche framework adds 20% to your timeline.
  • Freeze feature work during the migration. Trying to ship new features in two stacks at once doubles your bug surface. Tell the business "no new features for 8 weeks" and mean it.
  • Set a hard stop date. Strangler-fig migrations die when there is no deadline. Pick a date, port the highest-priority routes first, and accept that the long tail might stay in PHP forever (which is fine).

The fastest path from PHP to Node.js

If you have decided to migrate, here is the practical sequence we recommend:

  1. Audit first. Spend one week understanding what you actually have. Count routes, list third-party integrations, identify the 20% of code that handles 80% of traffic. A senior engineer can do this in a few days.
  2. Pick the pattern. Based on the audit, pick API-only, strangler-fig, or full rewrite. Do not let the team default to "full rewrite" because it sounds cleanest. It almost never is.
  3. Book the team. You need at least one senior who has done a PHP-to-Node migration before, plus a mid engineer for the grunt work. Hiring full-time for a 6-month project is expensive and slow. The faster path is on-demand. Cadence ships 4 vetted candidates in 2 minutes for any spec (Laravel + Fastify migration experience included), with a 48-hour free trial so you can verify fit before paying anything. A senior + mid pair runs $2,500/week combined, and you can cancel any week if scope shrinks.

Need someone who has done this before? Book a senior engineer on Cadence for $1,500/week. Every engineer is AI-native, vetted on real migration work, and you get a 48-hour free trial before billing starts.

For comparison, similar projects in adjacent stacks like the Next.js application build follow the same engineer-hour math.

FAQ

How long does a PHP to Node.js migration take?

Plan for 2 to 5 months for an API-only re-platform, 6 to 12 months for a strangler-fig migration, and 4 to 12 months for a full rewrite. Most migrations blow their initial timeline by 50%, so add a buffer.

Should I use TypeScript or plain JavaScript?

TypeScript, every time. The type system catches the class of bugs that PHP's loose typing was hiding. The migration cost is barely higher (Cursor and Claude Code generate types accurately) and the long-term maintenance is much cheaper.

What framework should I migrate to?

For most teams: NestJS if you want a Laravel-style opinionated framework, or Fastify if you want lightweight and fast. Hono is excellent for edge deployments. Avoid Express for new projects; it is in maintenance mode.

Can I migrate incrementally without downtime?

Yes, with the strangler-fig pattern. A reverse proxy routes each request to either the old PHP app or the new Node.js service. Users see no difference. You can run both stacks in parallel for months.

Is it worth migrating just for performance?

Usually no. For typical CRUD apps, your bottleneck is the database, not the runtime. Profile first. If your PHP app is slow, it is almost always slow queries, missing indexes, or N+1 problems. Fix those before considering a rewrite.

What about the team's existing PHP skills?

This is the underrated cost of migration. If your engineers know PHP well and Node.js poorly, you are trading expertise for vibes. Either invest in serious Node.js training first (2 to 3 months of paired work) or book engineers who already know the new stack. Mixing both leads to bad code.

All posts