by upmostly · 3y ago · 0 comments
Rails was such a huge part of my professional career.
Now, 13 years later and I'm deep in the JavaScript ecosystem and have been for 8 years.
The most exciting thing to come out of this ecosystem recently is RedwoodJS, because it takes a lot of inspiration from Rails.
I'm less likely in my career to stray away from whatever the old heads came up with. For instance the new thing is putting server/database calls in server side React components. But something tells me MVC was invented for a reason by people way smarter than me.
But the view layer has not aged well. After years of working with a focus on React and TypeScript, I can't stomach the Rails approach to views. As much as I appreciate the value proposition of Stimulus and truly feel the shortcomings of SPAs deep in my bones, I crave components, type safety, unidirectional data flow, and more options for styling than just classes. React in particular has rich options for UI frameworks that feel truly idiomatic. The last time I tried to start a project with Rails, I moved at a breakneck pace until I got to the view layer, at which point I had to pull the plug.
I'm reaching for Next.js these days because it's the closest I can get. It gives me the opinionated framework I crave plus server rendering and the ability to drop down into client-side rendering when it calls for it. Prisma is a damn good ORM, even if it doesn't have the intuitively ergonomic beauty of ActiveRecord. And of course, TypeScript throughout is a godsend.
But I still miss Rails. I miss the console, Sidekiq, the profound power of ActiveRecord for simple things with the ease of dropping back into SQL when I need it, the polish of FactoryBot and those easy easy easy tests. I miss the breezy and fluid syntax of Ruby. I don't feel limited by TypeScript, I love working with it, but TypeScript lets me lecture, Ruby lets me sing.
Any experience with it? What makes it far from perfect?
I pair Next with Nest (sigh, why only one letter different?) when I need a proper backend but I can get so far with Next that I’m using it less and less now.
If someone reading this has experience with both TS+React and modern Hotwire apps, you’d do the world a service by writing a blog about modern Rails views for the experienced React developer.
Also sprinkle some (rare) Stimulus and Turbo streams/frames.
The one thing you're gonna be missing is typing, Sorbet does not work in views.
Agreed - In my opinion, Rails messaging/soft marketing could be a lot better about how it's great for a data driven backend, whatever the frontend/UI.
I know there's things like API mode and webpacker, but this all seems very secondary and begrudging at times. Maybe I listen too much to what DHH says, but definitely think the Rails view stuff should be what's secondary. It's a turnoff for a lot of devs who would otherwise be quite happy with Rails as a backend.
It's in a somewhat weird spot: On the one hand it is mature and has amazing DX/UX going for it, with a lot of very thoughtful tooling. On the other, for some reason, it has always remained niche with just a couple of core developers, even though it's now nearing version 6 and at least 8 years of releases. I do not know why that is the case. It's a beautifully written full stack framework, taking having inspiration from both Rails and Laravel and in the world of web TS, it should get a lot more attention than it does.
Maybe it's just the weird name :^)
One thing is picking a library which I can replace if it it gets abandoned, etc. a very different one is picking a full stack framework where replacing it means rewriting everything.
If I wanted a full stack framework, I’d pick Laravel or Rails because they’re already proven, have a big community, are used by big names in the industry and I’m 99.9% sure they’ll still be around and maintained 5 years from now.
Having a community is nice and motivating, but that makes building good software over that many years without ever being the community darling more impressive to me and seems like a great indicator for deep commitment, that gives me a different kind of confidence than hype and VC money.
I am not sure which sustains better in 2023.
But of course Vue is a frontend framework, and maybe the appetite for those was higher (and associated risk was lower) than for a batteries-included JS backend framework like Adonis.
I still build in Rails. And even thought I tried alternatives I don't think anything is as stable and fast (for me) to create things.
Rails is love