DEV Community

Cover image for The Ultimate Showdown: Rails 8 vs Phoenix LiveView
Zil Norvilis
Zil Norvilis

Posted on • Originally published at norvilis.com

The Ultimate Showdown: Rails 8 vs Phoenix LiveView

If you are a Ruby on Rails developer, you have definitely heard about Elixir and the Phoenix framework.

It is almost impossible to ignore. The creator of Elixir, José Valim, was a core contributor to Rails. He built Elixir because he loved Ruby's beautiful syntax, but he wanted to fix Ruby's biggest problem: handling high concurrency and real-time features.

Very often I see developers asking if Phoenix is the "new Rails" and if they should abandon Ruby to learn it. Here is my honest breakdown of how Ruby on Rails and Elixir Phoenix compare in 2026, and which one you should actually use for your next project.

1. The Language: OOP vs Functional

The biggest difference between these two frameworks isn't the frameworks themselves. It is the language they are written in.

Ruby is strictly Object-Oriented. You create classes, you initialize objects, and those objects hold "state" (data that changes over time).
Elixir is a Functional programming language. There are no classes and no objects. Data is immutable. You pass data into a function, and it returns new data.

# ruby (Object-Oriented)
user = User.new(name: "zil")
user.capitalize_name!
puts user.name # Outputs: Zil
Enter fullscreen mode Exit fullscreen mode
# elixir (Functional)
user = %{name: "zil"}
# We pass the user data through a pipe of functions
updated_user = user |> Map.update!(:name, &String.capitalize/1)
IO.puts updated_user.name # Outputs: Zil
Enter fullscreen mode Exit fullscreen mode

If you have only ever written Ruby or JavaScript, learning Elixir will literally rewire your brain. It takes time to get used to it.

2. Performance and Concurrency (The Phoenix Win)

This is the main reason people switch to Phoenix.

Under the hood, Elixir runs on the Erlang VM (BEAM). This technology was built decades ago by Ericsson to run telephone switches. It was designed to handle millions of phone calls at the exact same time without crashing.

If a process crashes in Elixir, it doesn't take down your server. It just restarts that tiny process instantly.

Because of this, Phoenix can handle millions of active WebSocket connections on a single server. If you are building a real-time chat application, a live multiplayer game, or a stock trading platform, Phoenix will absolutely destroy Rails in performance and server costs.

3. The Database: ActiveRecord vs Ecto

When we use Rails, we use ActiveRecord. It is famous for being incredibly easy to use. It hides the SQL database from you.

# rails
@users = User.where(active: true).order(created_at: :desc)
Enter fullscreen mode Exit fullscreen mode

In Phoenix, you use Ecto. Ecto is not an ORM (Object-Relational Mapper) because Elixir doesn't have objects. It is a database wrapper that forces you to be very explicit about what you are doing.

# elixir
query = from u in User,
        where: u.active == true,
        order_by: [desc: u.inserted_at]

users = Repo.all(query)
Enter fullscreen mode Exit fullscreen mode

The Good: Ecto makes it very hard to accidentally write slow database queries. There is no "N+1" magic hiding behind the scenes.
The Bad: You have to write a lot more code. ActiveRecord is much faster for prototyping and building MVPs (Minimum Viable Products).

4. Frontend Magic: Hotwire vs LiveView

Both frameworks realized that building separate React/Vue frontends is exhausting. They both created solutions to let you write interactive, SPA-like apps using only server-side code.

  • Phoenix LiveView: This was the pioneer. When a user connects to a LiveView page, Phoenix opens a permanent WebSocket connection. The server holds the "state" of the page. When you click a button, the server calculates the change and pushes a tiny chunk of HTML over the socket to update the screen. Because Elixir processes are so lightweight, holding thousands of open websockets is easy.
  • Rails Hotwire: Rails answered with Hotwire. Instead of keeping a heavy, permanent stateful connection open for every user, Rails uses standard stateless HTTP requests (Turbo Drive/Frames) to fetch HTML, and only uses WebSockets (ActionCable / Solid Cable) when it needs to broadcast live updates.

Both are amazing. LiveView is slightly more powerful for deeply complex real-time UI, but Hotwire is simpler to deploy and scale because it relies on standard HTTP caching.

5. The Ecosystem (The Rails Win)

This is where Rails pulls ahead for solo developers.

If you want to add user authentication to Rails, you use has_secure_password or Devise. If you want to integrate Stripe, there is an official Stripe Ruby gem with thousands of StackOverflow answers. If you want background jobs, Rails 8 gives you Solid Queue out of the box.

Elixir's package manager (Hex) is growing, but it is nowhere near the size of RubyGems. If you are building a standard SaaS app and you need to integrate with five different third-party APIs, you will probably have to write the API wrappers yourself in Elixir. In Ruby, you just type bundle add ....

Summary: Which one should you pick?

The truth is, 95% of web applications do not need the insane concurrency power of Elixir.

  • Choose Phoenix (Elixir) if your app's main feature is real-time communication. If you are building the next Discord, WhatsApp, or a live betting platform, Phoenix is the best tool on the market. Period.
  • Choose Rails (Ruby) if you are building a SaaS, a marketplace, a blog, or a standard web application. The development speed, the massive ecosystem of gems, and the simplicity of ActiveRecord will help you launch your product weeks or months faster than if you used Elixir.

That's pretty much it. Both communities are fantastic, and learning functional programming with Elixir will make you a better Ruby developer anyway. But for getting a business off the ground quickly? I'm sticking with Rails.

Top comments (0)