elixir migration nodejs

Elixir vs Node.js: An Honest Comparison for 2026

Daniil Popov November 26, 2026

Elixir vs Node.js, from someone who picked a side

I run an Elixir agency in Luxembourg, so I'm biased. Keep that in mind and check every number below, the links are there for that. Before the agency I spent more than ten years building products on other stacks. Node.js is a good tool and I won't pretend it isn't.

Short version: Node.js wins on ecosystem and hiring. Elixir wins when you have a lot of long lived connections, a lot of background work, or a small team that owns the whole product. If you have a CRUD API with a React frontend and nothing hurts, stay where you are. If you run Node plus Redis plus a job queue plus a separate websocket service, and your team spends its weeks on the glue between them, keep reading.

The whole thing in one table

Node.js Elixir and Phoenix
How your code runs One JavaScript thread per process (the event loop), a small libuv pool for some I/O, worker_threads if you add them Many lightweight BEAM processes, one scheduler per CPU core, preemptive
A slow CPU task Blocks every request on that process, unless you move it to a worker thread Slows one process, the others keep running
An uncaught error Exits the whole process by default One process dies, a supervisor restarts it
Websockets on many servers Socket.IO plus a Redis adapter, or similar Phoenix PubSub across clustered nodes, no Redis
Background jobs BullMQ on Redis (a PostgreSQL backend exists now) Oban on PostgreSQL, MySQL or SQLite
Types TypeScript, mature, checked at build time Inferred and checked by the compiler (every program since v1.20), no type signatures yet
Frontend Usually a separate React or Vue SPA LiveView renders on the server, React still possible
Ecosystem and hiring Huge. 66% of Stack Overflow survey respondents use JavaScript Small. 2.7% use Elixir
Best fit Big teams, npm heavy products, serverless, code shared with the browser Real time, many connections, small teams

One event loop vs a lot of small processes

Node.js runs your JavaScript on one thread, the event loop. A small worker pool takes care of things like file I/O. That's why Node is good at I/O: one thread can wait on thousands of sockets and it costs almost nothing. It's also the weak spot. The Node.js docs are honest about it: if the event loop spends too long on one callback, "all current and new clients will not get a turn."

{@code}

Two seconds of CPU on that route, and every other user on that Node process waits two seconds. You can fix it. Move the work to worker_threads, a child process or a queue, then pass the data back and forth. To use all CPU cores you also run several Node processes, with cluster or more containers, and each one is a full copy of the app with its own memory.

Elixir runs on the BEAM, the Erlang VM. By default it starts one scheduler thread per logical CPU core. Your code runs in BEAM processes, which aren't OS threads and are cheap: a new process uses 327 words of memory, about 2.6 KB on a 64-bit machine. Phoenix gives every connection its own process, and every LiveView is a process too.

The schedulers are preemptive. A process gets a small budget of work, and when it's used up the process steps aside for the next one. One busy request can't hold a core hostage. (Catch: native code called through NIFs isn't preempted. Long running native code should split its work into short calls or run on the separate dirty schedulers.)

{@code}

This request is slow. The other requests keep getting CPU time and barely notice. I didn't write anything extra to get that.

To be fair to Node: if your app mostly waits on Postgres and HTTP calls, the event loop does fine and this section matters less. It starts to matter the day someone puts a PDF export or a big JSON parse on a busy route.

When something crashes

In Node, an error thrown inside an Express or NestJS handler is usually caught by the framework and turned into a 500. The trouble is outside the handler: a timer, an event emitter, a callback deep in some library. By default an uncaught exception prints a stack trace and exits the process with code 1. An unhandled promise rejection ends up the same way. The docs also say it's not safe to resume after one. So the process dies, every connection on it dies too, and your process manager starts a fresh one.

In Elixir a crash takes down one process. If the code for one request or one websocket blows up, that process dies and the rest keep going. Supervisors restart what needs restarting. Here is the top of a Phoenix app's tree, a bit trimmed:

{@code}

Database pool, pub/sub, job queue, web server. If one of them crashes, the supervisor restarts just that one and the others keep running. If it crashes too often, the supervisor gives up and the failure moves up the tree, so a real bug doesn't loop forever.

Websockets and real time at scale

Here the gap is biggest. A websocket stays open for minutes or hours. In Node thousands of them share one event loop, which works until one handler does too much. The harder part starts with your second server. A message sent on server A has to reach users connected to server B. With Socket.IO you add an adapter, and the common one relays broadcasts through Redis pub/sub. So now Redis sits in your real time path.

Phoenix comes with Channels, PubSub and Presence. Connect your servers into a cluster and a broadcast reaches subscribers on every node over the BEAM's own distribution. No Redis. Each connected user is one process with its own state.

Two numbers, with dates, because they're old. In 2015 the Phoenix team held about 2 million websocket connections on one 40 core, 128 GB server, and what stopped them was a ulimit setting. In 2017 Discord reported nearly five million concurrent users on an Elixir system where each user's websocket gets its own session process. Old posts, old versions. I show them for the model. Your app needs its own load test.

Background jobs: BullMQ vs Oban

BullMQ is the usual answer in Node, and it's good. It runs on Redis by default and now has a PostgreSQL backend too. Your workers are Node processes that pull jobs from the queue, often deployed as their own service.

In Elixir the usual answer is Oban. It keeps jobs in PostgreSQL, MySQL or SQLite, so in the database you already run. Workers live inside your app, under the same supervisor. A job is a row in your database, so you can insert it in the same transaction as your data:

{@code}

Invoice insert fails, the email job never exists. Invoice commits, the job is there. You don't need an outbox table, and you never get the "invoice saved, job lost" ticket. To be fair, Node can do this too with a PostgreSQL queue: pg-boss creates jobs inside your existing transaction.

In our own migration Oban replaced a Java workflow engine, its monitoring UI and the Elasticsearch it needed. Long story in Good Choices That Aged Badly.

TypeScript vs Elixir types

Node wins this one today. TypeScript is mature, editor support is great, and you can share types between backend and frontend. Node even runs .ts files directly now: type stripping is on by default since v22.18 and v23.6, and stable since v24.12 and v25.2. It only handles erasable syntax and removes the types without checking them, so tsc still runs in CI.

Elixir is dynamically typed, and the type system is arriving in steps. Elixir v1.20, released in June 2026, infers types for every program and warns about code that is guaranteed to fail at runtime. You don't write a single annotation for that. You can't write your own type signatures for it yet either, that's a later milestone. (The old @spec typespecs still exist for docs and the separate Dialyzer tool, but the new type checker doesn't use them.)

Day to day, Elixir code leans on pattern matching and tests, and the compiler now catches a real class of bugs on top. If you come from strict TypeScript it will feel looser at first. Some people like that, some hate it. Port one real module before you decide.

Ecosystem and hiring: Node wins

No contest. In the 2025 Stack Overflow survey 66% of respondents use JavaScript and 43.6% use TypeScript. Elixir is at 2.7%. Among web frameworks, 48.7% use Node.js, 19.9% Express and 6.7% NestJS. Phoenix: 2.4%.

npm has a package for almost everything, and most SaaS vendors ship their JavaScript SDK first. Hex, the Elixir package registry, is much smaller. Sometimes you'll write a thin client for some HTTP API yourself. With Req it's an afternoon, but in Node you wouldn't spend that afternoon at all.

Hiring is the real cost. There are fewer Elixir developers, full stop. What helps: you need fewer of them, because one person can own a feature from database to screen. And good engineers learn Elixir fast. If you want to see what a complete Elixir stack contains, read our Elixir tech stack overview.

LiveView vs a separate React SPA

A typical Node product is two apps: an Express or NestJS API and a React frontend built with Vite. Two codebases, an API contract in the middle, and state living on both sides.

Phoenix LiveView renders the UI on the server and keeps it live over a websocket. A click goes to the server, the server changes state, LiveView sends a small diff to the browser. You don't design an API for your own frontend, because you don't have a separate frontend. When you do need JavaScript, hooks and colocated hooks let you write it right next to the component.

That's where our biggest numbers came from. The accounting SaaS we rebuilt ran on Python, React with Vite and a Zeebe workflow engine. Its frontend went from 18,797 lines to 1,330, and the whole rebuild took three weeks.

Our migration Before After Change
Lines of code 68,850 25,185 63% less
Source files 588 144 76% fewer
Docker services 6 1 83% fewer

LiveView isn't for everything. It needs a live connection, so offline first apps and heavy client side editors (think a drawing canvas) are better as a real SPA. A native mobile app needs an API anyway. For those, Phoenix works fine as a JSON or GraphQL backend behind React.

Elixir and React together

You don't have to pick one. Setups I'd consider:

  • Keep React as it is and use Phoenix as the API. Phoenix controllers return the same JSON your Express routes did, and the frontend doesn't notice.
  • Build pages in LiveView and drop React components in where you need them, with a hook or with a library like live_react that keeps props in sync between the server and the component.
  • Go LiveView for nearly everything and keep React for the one or two heavy widgets that earn it.

Elixir vs Vite?

People really search for this, so here's the short answer: you can't compare them. Vite is a build tool for frontend code, a dev server with hot reload plus a bundler for production. It doesn't run your backend. Elixir is a language, and Phoenix is the backend framework.

The real question is usually "can I keep my React and Vite frontend if I move to Phoenix?" Yes. Phoenix serves the API, Vite keeps building the SPA. If you go with LiveView, a new Phoenix app uses esbuild and Tailwind through Elixir wrappers and doesn't need Node.js at all. If you like Vite's dev server, the phoenix_vite package plugs Vite into Phoenix in place of esbuild.

Funny part: the React frontend in our migration had a Vite build pipeline with its own opinions about Node versions. After the move there was no Node left to have opinions about.

Phoenix vs Express vs NestJS

Express is minimal. Routing and middleware, the rest is up to you. NestJS is a structured framework on top of Express (or Fastify), with modules, dependency injection and TypeScript first. Phoenix is closer to NestJS in how much it gives you. NestJS has official modules for databases and websockets too. Phoenix adds LiveView for UI, an auth generator (mix phx.gen.auth), and Channels and PubSub that work across a cluster without Redis.

Comparing other stacks too? Same kind of post for FastAPI vs Elixir and Elixir vs Rails.

Running cost

I won't give you a benchmark. A synthetic benchmark says very little about your app. Here's where the money goes.

Node is cheap per request for I/O work. The cost sits around it: one process per core and the memory that comes with it, often a Redis for the queue and the websocket adapter, maybe a real time service and a worker fleet on the side. Every one of those is a bill, and something somebody has to watch at 3am.

An Elixir app uses all cores from one OS process and runs jobs, pub/sub and websockets itself. Production is often just the app and Postgres. In our migration 6 Docker services became 1, and infrastructure config went from 5,448 lines to 439. That's where the savings were. Elixir didn't answer any single request faster.

When to stay on Node.js

  • You have a CRUD API, the team ships fine and nothing hurts.
  • You share a lot of code between browser and server, or you live on serverless functions where Node is the default.
  • You depend on npm packages or vendor SDKs that have no equal in Elixir.
  • You have to hire twenty people this year in a city with no Elixir developers.
  • Your team doesn't want to switch. A stack forced on a team is a bad stack.

When to move to Elixir

  • Real time is the product: chat, live dashboards, collaboration, IoT.
  • You fight the event loop. CPU work blocks requests and you keep adding workers and queues around it.
  • Your stack is Node, Redis, BullMQ, a websocket service and a React SPA, and every feature touches three of them.
  • You're a small team and you want one person to own a feature end to end.
  • Uptime matters more to you than the size of the hiring pool.

My rule of thumb: count the services you deploy for one feature. If it's more than two, the stack is costing you more than the language ever will.

How a module by module migration works

You don't rewrite everything on a Monday. We move one piece at a time, with both apps live:

  1. Put Phoenix next to Node behind the same reverse proxy, on the same PostgreSQL database. Ecto schemas map your existing tables, so there's no data migration on day one. (On MongoDB this step is more work.)
  2. Settle auth first, so both apps trust the same login, for example by checking the same session token.
  3. Move the part that hurts most. Often that's websockets or background jobs, because Elixir pays off fastest there and Redis can leave.
  4. Switch routes over one at a time at the proxy. The React frontend keeps calling the same URLs and has no idea who answers.
  5. Replace pages with LiveView where it makes sense, or keep React. Delete the Node app when nothing routes to it.

Every step ships on its own and you can stop at any point. Longer version in our legacy software modernization guide, and here is how we run migrations.

FAQ

Is Elixir faster than Node.js?

Not in a way that matters for most web apps. V8 is very fast at raw JavaScript, and for heavy number crunching neither one is the right tool. Elixir is better at staying steady under load, when slow and fast requests share the same machine. Measure your own workload.

Is Vite an alternative to Elixir?

No. Vite builds frontend code. Elixir and Phoenix run the backend. You can use them together.

How long does a migration from Node.js take?

Depends on the product. Our full rebuild of a production SaaS took three weeks, and that one was Python and React. We start with a paid assessment, so the estimate is based on your code.

Want a second opinion on your Node.js stack?

Node.js is fine. Running five things to ship one feature isn't. We start every engagement with a paid technical assessment: we read your code, find what hurts and tell you if moving to Elixir pays off. Sometimes the answer is no.

Resources

Share