A Front-End Journey
back to Rails
Or “How I learned to stop worrying & love the Hotwire”.
Kevin Vanzandberghe @kevinvzb
Hello!
Work: Nodalview
Play: Tabletop RPGs
Rails front-end
across the years
A few attempts
React…
React…
React…
React…
React…
Excellent UI fidelity.
Huge overhead.
Next.js
React meta-framework
Time for a choice
No more hybrid stack.
One or the other.
First attempt: Next.js
“Famous last words”
“I’m going to need Rails at some point for that…”
Missing a lot
Feature | Rails | Next |
ORM | ActiveRecord | No |
Background Jobs | ActiveJob | No |
File Uploads | ActiveStorage | No |
Deploy anywhere | Yes | Kinda? |
Is in Ruby | Yes | No |
Increasing complexity
Second attempt: Rails
Kind of obvious in hindsight
One goal
All of Rails, without sacrificing UI/UX/DX.
I still want all that:
Can I?
Let’s find out!
Components
Components
Basics
Components
Views & Controllers
Components
Slots
Components
Interactivity
Components
Stimulus
Components
Bonus: Hooks
Demo
Suspense
Suspense
Demo
Inline Forms
Inline Forms
Index page
Inline Forms
Form page
Inline Forms
Controller
Demo
Loading States
Loading states
Demo
Live Updates
Live updates
Demo
Mission accomplished?
I’d say so.
But wait, there’s more…
Well, there’s less.
Fewer things to do for the same result.
No more
Internal APIs your front-end is the sole consumer of.
No more
Hard to debug local states.
No more
Duplicated logic across 2 half-stacks.
No more
Interminable asset compilations.
No more
Building expertise in two different frameworks.
Lessons
Tradeoffs
Tradeoffs
Minus
Tradeoffs
Plus
I’m finding joy again
QA
hotwire-resources
All the links I’ve compiled while learning this.
github.com/kvzb/hotwire-resources
Thanks!