Get part 1 for free:
By now you’ve probably heard of the Elixir language and Phoenix framework - they’ve been causing a stir among developers, and for good reason. Phoenix is rising, becoming the go-to choice for developers who prioritize productivity, reliability, and performance in their web applications.
But like you, I struggled at first to learn these new technologies. As an experienced Ruby on Rails developer, it was frustrating to start again in a new framework. Most tutorials out there are too basic, poorly explained, or out of date - and the official documentation is only really useful if you already know what you’re looking for.
So I’ve written the guide I wish I’d had. Phoenix on Rails is a tutorial on web development with Elixir, Phoenix and LiveView that’s specifically tailored towards Ruby on Rails programmers. It teaches what you need in terms that are easy to understand based on what you already know, explaining everything in an intuitive manner that makes maximum sense to a Rails developer.
In the 2023 Stack Overflow developer survey, Phoenix was rated the world’s most admired web framework. Phoenix takes everything that made Rails popular and improves on it tenfold, letting you build feature-rich, scalable and maintainable apps at lightning speed.
As Rails uses Ruby, so Phoenix uses Elixir, a functional programming language that runs on the Erlang VM. Erlang is well-known for its scalability, performance and fault-tolerance. Elixir takes the power of Erlang and wraps it in a beautiful, elegant, Ruby-like syntax.
Elixir and Phoenix were built by former Rails developers, and their design takes heavy inspiration from Ruby in Rails. As such, they’re rapidly growing in popularity among Rails developers. If you’re bored of Rails and want to take your career to the next level - or if you just want to explore something new - Phoenix is the perfect choice!
It’s painful to start from scratch. Elixir looks like Ruby at a glance, but its underlying design is very different. Elixir is a functional language where everything is immutable, there are no “objects” or “classes”, and you often need to structure your code completely differently from the equivalent Ruby.
And while Phoenix takes inspiration from Rails, there’s still a learning curve. Some concepts, like “controllers”, “migrations” and the “router”, are familiar to a Rails developer - but others, like Phoenix’s “repo”, “changesets” and “components”, have no direct analogy in Rails. The result: confusion and frustration when you’re not sure how to do something in Phoenix but you know how you’d do it in Rails.
You’ve invested so much time into learning Ruby on Rails. Why throw it away? Your existing knowledge gives you a big head-start, and you’d be foolish not to make the most of it.
Every sentence of Phoenix on Rails is written with Rails developers in mind. It’ll teach you Elixir and Phoenix from the ground up, explaining how each concept relates to what you already know, where things are similar and where they differ, what has a direct analogy and what’s less familiar. Your existing knowledge will turbo-charge your learning.
Phoenix on Rails is the fastest way to learn Elixir and Phoenix if you already know Ruby on Rails - guaranteed.
Questions? Keep scrolling down, or send an email .
You can try Phoenix on Rails 100% risk-free. Sign up, and if you find the course isn’t for you, send an email within 14 days of purchasing to receive a full refund.
Phoenix on Rails consists of 72 written lessons.
Phoenix on Rails assumes no prior knowledge of Elixir. Part 1 will teach you all the Elixir you need to build a fully-featured Phoenix app. We’ll start with the three most important differences to understand between Ruby and Elixir. Then we’ll move through every important Elixir concept, relating it all to what you already know from Ruby.
Elixir and Ruby are more different than they first appear. The syntax is similar, but Elixir’s underlying design can be confusing to a Rubyist. Phoenix on Rails will get you familiar with the functional paradigm and everything it entails: recursion, pattern matching, the pipe operator and more. Even if you already know Elixir, you might still find Part 1 useful, as it will help you relate Elixir’s concepts to the Ruby you already know.
Elixir has many different types and data structures such as strings, lists, and maps. Some are easy to understand, like “atoms”, which are basically the same as Ruby’s “symbols”. Others are less familiar, like “tuples”, which have no direct analogy in Ruby. Phoenix on Rails will teach you how to use all of Elixir’s different types and data structures, explaining everything in terms that make maximum sense to a Ruby developer.
Now that you know Elixir, it’s time to learn some Phoenix! In Part 2 you’ll use Phoenix to build a simple app that’ll introduce you to all the major parts of the Phoenix stack. Some concepts will be familiar from Rails, like controllers, migrations and the router. Others will need more instruction - like components and contexts. We’ll cover them all.
In Rails you query and update your database using ActiveRecord models. In Phoenix, you do the same with Ecto - but Ecto’s approach is very different to ActiveRecord’s, and it’s one of the trickier things for a Rails developer to get used to. But don’t get discouraged - Phoenix on Rails will guide you gently through the four main parts of Ecto until you’re as comfortable with Ecto as you ever were in Rails.
Phoenix has changed a lot recently, and many existing tutorials are out of date. Phoenix on Rails teaches Phoenix 1.7 - but it doesn’t ignore Phoenix’s history, Where there have been major changes to Phoenix - such as when version 1.7 overhauled how “components” and “views” work - the course makes sure to educate you about what’s new and how things used to be. You’ll be thankful for this knowledge when you’re dealing with legacy code or struggling with old tutorials.
In Part 3 we’ll study some of Elixir’s more advanced features, starting with dependency management. In the Ruby ecosystem, you use bundler to manage your gems. Phoenix on Rails will introduce you to all the equivalent tooling from the Elixir world, such as Hex and Mix.
Other topics covered in part 3 include Erlang interoperability, and trickier Elixir keywords like use and with.
In Part 4 we’ll add new features to the CRUD app from part 2.
Advanced Rails developers will understand how Rails sits on top of Rack, a low-level Ruby tool for interfacing with web servers. The Phoenix equivalent is Plug, and everything you do in a Phoenix app is fundamentally about manipulating a “Plug.Conn” struct. There’s no handwaving in Phoenix on Rails - we take a close look at how Plug works and how it integrates with every part of your app.
Phoenix, like Rails, provides scaffolds - simple commands that let you generate huge amounts of working code. In Phoenix on Rails we make use of Phoenix’s scaffolds - but you don’t just run them and forget about them. Whenever a scaffold is used we take a close look at what was generated so that you understand exactly what it does. Studying the output of Phoenix scaffolds is a great way to learn about Phoenix’s intricacies and best practices.
LiveView is arguably Phoenix’s killer feature. With LiveView you don’t need Javascript to create a dynamic frontend - you can add interactive behaviour to your UI using Elixir alone. Phoenix on Rails will teach you everything you need to know about LiveView. Large parts of the two apps you build will use LiveView to render their UIs.
In Part 5, we’ll demystify Elixir’s often-overlooked typing system.
Elixir, like Ruby, is a dynamically-typed language - but that doesn’t mean we must lose all possible benefits of static typing. Instead, we document types using typespecs and validate them using Dialyzer and Dialyxir, enforcing types without compromising the expressiveness and flexibility of Elixir.
APIs are the backbone of modern web applications, and Phoenix provides a clean and efficient way to build them. In Part 6, we’ll update our Phoenix app to serve a RESTful API via JSON. By the end of this section, you’ll be adept at creating APIs that can serve any front-end application.
In Part 7 we’ll build a new, more advanced app from scratch. The first thing we’ll add is an authentication system so that users can log in. In Phoenix we don’t need any external dependencies like Rails’s Devise to create a fully-featured authentication system. Users will be able to register, sign in, recover their password and confirm their email address - and Phoenix’s generators let us add all of this with mere minutes of effort. We’ll thoroughly examine the generated code to understand exactly what we’ve created.
Once you’ve seen what’s possible with LiveView, you’ll believe what I believe - that Phoenix LiveView is the future of web development, We won’t shy away from LiveView in this course - it’s time to go deeper. We’ll see how to live validate a form, navigate between LiveViews with secure authentication, use a LiveView to upload files, and more.
Other topics covered by Phoenix on Rails include: styling your app with Tailwind CSS, managing your front-end assets with esbuild, rendering static files from your server, interfacing with Erlang libraries, and building advanced associations using Ecto. As always, everything is explained as intuitively as possible for a Rails developer.
I’ve been a professional software developer since 2012, and have been coding in Elixir and Phoenix since 2019. Before Phoenix I worked full-time with Ruby on Rails for five years.
I loved Rails at first, but over time I became frustrated with the framework’s limitations. The much-vaunted “Rails way” lets you develop apps quickly when you’re getting started, but eventually those same shortcuts come back to bite you and slow you down. I was looking for a better way to make web apps, and I found it in Phoenix.
Elixir and Phoenix were a joy to discover - the language is beautiful, the framework is excellently designed, and they solved so many of the problems I’d been having with Rails and Ruby. But the learning curve was steep, and I got frustrated with the lack of good learning materials. That’s what inspired me to create Phoenix on Rails.
Phoenix on Rails is aimed at developers who already have at least some experience programming in Ruby on Rails. If you don’t know Ruby or Rails, you might still get some value from this course, but it’s not guaranteed.
The current version of the tutorial uses the latest version of everything as of 2024: Elixir 1.16, Phoenix 1.7, and LiveView 0.20.
No. Phoenix on Rails will teach you the Elixir language alongside the Phoenix framework.
Even if you already know Elixir, you might still learn something from the Elixir section of the course, as it will help you understand how Elixir’s concepts relate to the Ruby concepts you already know.
Yes, Phoenix on Rails includes an introduction to LiveView. Both of the applications you’ll build will use LiveView for part of their frontends.
Phoenix, like Rails, is a server-side technology. Phoenix on Rails covers the basics of managing a Phoenix app’s frontend assets including Javascript and CSS files, but it doesn’t explain how to build a single-page application or a highly dynamic frontend using modern Javascript frameworks like React or Vue.js.
However, one of the many things developers love about Phoenix is that you don’t need Javascript to create a dynamic frontend. With Phoenix LiveView you can add interactive behaviour to your app’s frontend using Elixir alone, without the need to write any custom Javascript. Phoenix on Rails will teach you how this is done.
Since Phoenix 1.7, newly-generated Phoenix apps use Tailwind.css for their styling. You don’t have to use Tailwind in your Phoenix project - it’s easy to, for example, use SASS, LESS, or vanilla CSS instead - but Tailwind is the default.
Tailwind is a simple framework that’s very quick to learn. Phoenix on Rails will teach you the basics of Tailwind, and the apps you’ll build will use Tailwind for their styling.
Maybe. Send an email explaining your situation and I’ll see what I can do.
I’d love to hear it! Get in touch on george@arrowsmithlabs.com.
Still unsure? Enter your email address to access Part 1 of the course for free, forever: