Purchase

Introducing Phlex on Rails

Officially launching a video course for building component-based UIs in Rails

A few months ago, I had the idea of creating a Phlex on Rails video course outside, while hiking, in between my kids’ summer camps. Today that’s finally a reality with over 7 hours of instruction split across 7 units and 45 videos.

One crazy thing I did for this course is shoot it outside, so there are a few videos where cows wander in, turkeys go by, or I get dive-bombed by yellow jackets.

Too many Rails shops are reaching for React, Vue.js, and other heavy frontends

I’ve been talking with a lot of Rails shops lately. They aren’t choosing React, Vue.js, and other heavy frontends because they want more JavaScript. They’re choosing them because they want components to build complex UIs.

Rails’ closest opinion on components is “use partials and helpers.” That’s fine for small apps, but as a codebase grows, the view layer tends to unravel into a tangle of templates and helpers. It’s especially evident in decade-old Rails apps where multiple “vintages” of patterns coexist.

What people really want is a way to build UIs with components

Another weird thing I’ve been noticing: a significant number of people creating new Rails applications today use it for the backend and React or an equivalent for the frontend. Why is that?

“Rails is a great backend.” I ran into this many times and 100% agree—Active Record is a concise way to model data and Action Controller is just as good at exposing said data to HTTP, dealing with authorization, etc.

It turns out components are a great abstraction for building complex UIs. They’re so good that people are willing to bring the complexity and bloat of JS frameworks like React or Vue.js into Rails so they can snap pieces together and quickly ship frontends.

Phlex & Hotwire accomplish this without bringing in all the additional “moving parts” of complex JS stacks.

This course is about shipping component-based UIs without the bloat of JS frameworks

The Phlex on Rails course covers everything you need to build production-ready component-based UIs in Rails. Here’s what we cover:

Getting Started - We start with the “why” behind Phlex and components. You’ll learn the tactics and strategies for building user interfaces with Phlex and Rails, and how this will improve your development workflow.

Component Fundamentals - Phlex components are self-contained Ruby classes that can be “snapped” together. We explore how to use the full power of Ruby to compose UIs, work with HTML generation, blocks, inheritance, and test your components.

Existing Rails Apps - Most Rails apps aren’t greenfield projects. I’ll show you how to install Phlex into an existing Rails app that uses ERB, Haml, Slim, or ViewComponents. You’ll learn strategies for organizing your components and gradually migrating views without rewriting everything at once.

Build Forms with Components - Forms in Rails can be painful to customize. I introduce Superform, a powerful form builder built entirely on Phlex that makes it easy to build and customize forms. You’ll learn how to build form components, customize them through inheritance, share them across your app, and work with strong parameters.

Phlex and Hotwire - Phlex components encapsulate views perfectly for Hotwire. We cover using Phlex with Turbo Frames, Turbo Streams, Turbo Broadcasts, and Page Morphs. You’ll also learn how to integrate Stimulus controllers with Phlex components and separate concerns properly.

Styling with CSS & Utility Frameworks - Components and utility CSS frameworks are a perfect match. We’ll install and configure Tailwind CSS in a Rails app, build styled components, and even integrate DaisyUI for pre-built component styles. You’ll also learn helper patterns for managing CSS classes in components.

Pure Phlex Rails Apps - For the ambitious, I show you how to build a Rails app completely with Phlex components using Superview. We extract views from controllers, build layouts, integrate Superform, and see how everything comes together in a pure Phlex Rails app.

By the end, you’ll have the skills to build component-based UIs in Rails that rival what you can do with React or Vue.js, but without the complexity and bloat of JavaScript frameworks.

Take the course

If you’re ready to build component-based UIs in Rails without the JavaScript framework bloat, now’s the time. You can get started by watching the introductory video. When you’re ready to buy, I’m offering $50 off the course price for launch until November 1.

Support this website for more original articles

If you enjoyed reading this article and want to use Plex with Rails, consider purchasing the Phlex on Rails video course.

Order the Phlex on Rails video course for $379 $329