crispinb

crispinb

Rails and Phoenix as 'one person frameworks'

On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never having used Rails, and (despite my best intentions when coming across Elixir and Phoenix earlier this year!) not yet having done anything substantial with Elixir/Phoenix, I’d be interested in hearing perspectives from those who have used both in production.

Specifically: assuming sound skills in the respective language and framework (ie. entirely putting aside the ‘use what you know’ argument), what forces would push you to choose one versus the other for to build a competitive one person business?

Most Liked

josevalim

josevalim

Creator of Elixir

I would say which one is better depends a lot on the person and on the project.

For example, you might ask: 6-12 months from now, how quickly can you still add features and fix bugs? When there is a new framework version, how much time can you afford to spend on upgrading it?

Being a one person project goes both ways. It also means the penalties of version upgrades, maintenance, dealing with spikes even at low scale falls on the shoulders of a single person, who now won’t have the time of doing any new feature development.

EDIT: @stefanchrobot also has a very good point below. The Phoenix stack is also leaner, you need Phoenix and a database. Most other frameworks will require additional components by the time of deployment.


Overall, I agree with DHH, that we have seen a huge ramp-up in complexity in the last decade when it comes to web development. Much of it was necessary and caused by improvements in standards and practices around security, privacy, user experiences, etc.

However, some of this complexity was brought by moving the logic to the client, which naturally creates a split between client and server. The movement started with Phoenix+LiveView shows the server is equally capable of powering rich and interactive user experiences. And now, with esbuild, sass, and tailwind-standalone, we can get rid of npm and limit JavaScript to the front-end only, as it was 10 years ago.

But the truth is: there is still a huge amount of complexity and best practices in place, and I think you are right that the best one person frameworks are likely to be Wordpress, Shopify, and projects like Supabase.

I also must say that, in general terms, this is really a fight for JavaScript to win. Most LiveView-like solutions focus exclusively on using the server to push updates. LiveView goes further to provide form handling, file uploads, JS commands, etc. Therefore it provides a better one person experience but you still cannot run from JavaScript!!!

Theoretically speaking, the JavaScript community could create the “most compact” one person client+server framework, with fewer moving parts and integrations, but for some reason there doesn’t seem to be a lot of interest in doing so. When it comes to the client, most JavaScript solutions treat the server as an additional step or dismiss it altogether. Or maybe my lack of experience makes me unable to see how hard it actually is to create an all encompassing solution in JavaScript.

23
Post #4
benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

I think Rails is well described as the one person framework, and I mean that in both positive and negative ways. What a single person can accomplish in rails and within the broader rails ecosystem is generally exceptional. There are a ton of libraries, and a ton of “batteries included” stuff within the set of core Rails gems.

The downside is that, in my experience, as more people work on the code base and the application becomes heavier under the weight of complexity and history it often develops bottlenecks. I don’t really mean in the performance sense, but rather in the workflow or conceptual sense. Certain core data models often grow immensely large as they start to be used in many different situations, and various details tend to have cross cutting implications across the whole code base.

Phoenix also puts a lot of power in the hands of a single developer. I think the library ecosystem in Elixir is good, but quite as comprehensive or plug and play as in Ruby. Phoenix / Ecto tend to require more boilerplate for any given feature in the spirit of explicitness (which I think is a good thing) but this can make churning out 15 different CRUD pages a bit slower.

Phoenix and Elixir in general have a much stronger notion of internal modular functionality. Phoenix contexts try to group related database tables, and supervision constructs tend to create clusters of process management code that I think lend themselves to better scaling as teams and companies grow.

21
Post #2
iangreenleaf

iangreenleaf

I’ve spent a fair amount of my professional life building and/or maintaining one-person apps in production (or two-to-four-person apps, which is not as catchy of a name but has many similarities). I don’t think you should focus too much on the idea of a literal single person, but rather, on the ability to maintain an application with a very modest input of developer resources. IMO both Rails and Phoenix are both best in class in this category.

What DHH mentions in passing is that there was a golden era in which Rails really did make it possible for a single person with mid-level experience to maintain a complex web application and even enjoy doing so! The rapidly escalating demands and complexity of the frontend have dashed that possibility for many web applications. These days, rich UI experiences are a baseline expectation for many apps, and rich UI experiences are very hard to build without committing to a heavy frontend framework, which these days is typically React. Not only is React a different language, it’s a completely different paradigm with almost entirely novel conceptual models, performance concerns, development tooling, etc. It’s a lot for even a very senior dev to keep a handle on while simultaneously maintaining a backend. To make matters worse, the huge amount of churn in Javascript packages means you are perpetually on the hook for breaking updates, abandoned modules, etc. Adding React to a non-toy project introduces a huge maintenance liability and puts you on a swift track out of one-person-app land.

To me, one of the biggest value propositions of LiveView is that it greatly expands the scope of which projects can avoid introducing React and incurring all this liability. LiveView makes it possible to build UIs that are rich and performant enough to satisfy the needs of many modern web apps, and it is powerful enough to remain in one-person-framework land while doing that. A lot of Rails apps have React dependencies even though they’re not doing anything especially fancy, simply because Rails hasn’t historically had a good answer for what to do when you need more than “a sprinkle” of JS but less than the whole enchilada. I haven’t used Rails 7 yet but it will be interesting to see if it makes headway in this area.

To answer the original question about when I would choose one versus the other, here’s how I would look at it in the current moment:

  • If my app needs very little rich UI, I can write a little bit of vanilla JS, skip React, and use Rails or Phoenix. Either one is good.
  • If my app needs a lot of rich UI, I can suck it up and use React, and the backend can be Rails or Phoenix. Either one is good.
  • If my app needs some rich UI, I can use Phoenix+LiveView and skip React. Phoenix is the clear winner at the moment.

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19204 150
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
paulanthonywilson
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things. But I don’t think this is ...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement