DEV Community

Will Ceolin for Zoonk

Posted on • Originally published at github.com

Why I chose Elixir & Phoenix for UneeBee

This post is the answer to a question I got on Twitter.

I established the following criteria for choosing a framework for UneeBee:

  1. It should allow me to move fast without much external help.
  2. It should allow me to easily customize things according to my needs.
  3. It should have a good performance that allows me to save money on servers.
  4. It should allow me to create interactive pages with minimal effort.
  5. It should provide good tooling.
  6. It should be type-safe.

Frameworks

I considered the following options:

Moving fast

I've been working with JavaScript for 14 years and I had lots of experience with Next.js. So, that was my initial choice. But, even though I love Next.js, I don't consider it a really full-stack framework since it doesn't come with the model layer and I wanted to reduce the work I have to do. Plus, Next.js uses a lot of RAM when using npm start. I'd need a serverless solution but they can get quite expensive. 1TB of extra bandwidth on Vercel, for example, costs $400. I wanted something more cost-efficient.

Rails, Laravel, Django and Phoenix seemed much more robust solutions for moving fast as they have more full-stack features working out-of-the box. Database, Auth, Mailing, Background jobs, etc.

Customize

Requirements often change. Problems happen all the time. I wanted something that was easy to debug and customize. Rails favors "convention over configuration". That's good for moving fast but not so good for customizing. There are certain ways to do things and I wanted more flexibility.

Phoenix, Laravel and Django felt easier to customize. I love how flexible Phoenix is. Their generators, for example, just write the code for us. This means we can easily customize all the generated code.

Performance

Built on top of the Erlang VM, Phoenix deals much better with concurrent connections. It's very efficient RAM-wise. I've been quite impressed how much I'm able to accomplish with just 256MB RAM. I had some issues with other frameworks when using low RAM.

Its performance is so good that I didn't even feel the need to use something like Redis for caching.

Interactive

This one was hard and almost made me move back to JavaScript. I'm building an application to create interactive courses. Even though it looks simple now, it will have much more interactivity in the future.

Laravel has Livewire, Rails has Hotwire, and Phoenix has LiveView. Django has some community alternatives but nothing that seems much popular. I worked with Django in the past and we usually had JS frameworks for the frontend.

I love how smooth Livewire and LiveView are. I'm still a little bit concern about LiveView using WebSockets because it requires a permanent connection with the client, which could be bad if your connection is unstable. But, overall, I liked how little JS I need to write with LiveView.

Tooling

I think they all provide good tooling but I was quite impressed by how many things Elixir provides out-of-the-box, especially testing, formatting, and even documentation.

Jason Stiebs wrote a good blog post about it.

Type-safe

Even though Elixir isn't a typed language, it provides good tooling to make it type-safe. Using a combination of Typespecs and Dialyzer has been good enough.

Conclusion

Phoenix provided a great cost-benefit. Excellent tooling and performance, I can easily create interactive UIs using LiveView, it has good enough type-safety with Typespecs and it's highly customizable. Plus, it's a functional language, which is my favorite paradigm.

The main down sides are:

  • Learning curve: Elixir can be a hard language to learn. There's a lot of concepts to grasp and I don't think I even understand them all yet. The good thing is that you can get pretty far knowing the basics only.
  • Community/Resources: It's not as big as the other programming languages. This means fewer learning resources out there.
  • Contributions: Since the community isn't as big as others, this means the project will probably get fewer contributions. The adoption would probably be much higher using Ruby, JS, PHP or Python.

Top comments (3)

Collapse
 
tfantina profile image
Travis Fantina

Great choice! I'd be curious to know how you feel about the choice in a year or two down the road! I've been developing some big Elixir/Phoenix apps for the past four years and every day it's a joy to work with. I'm so happy I get to work in this niche.

BTW as far as the learning curve goes; my first job as a developer I was put on an Elixir project on day 1 having never written a line of Elixir. I was a self taught Rubyist and had picked up a bit of JS along the way. I found learning Elixir to be both a joy and fairly straightforward. The first class documentation for nearly everything is a huge help!

Collapse
 
dmitridon profile image
Dmitri Don

Elixir and Phoenix are amazing, we are team of 6 developers switching to them at the moment... taking few online course to get to know them, and so far very positive experience.

Collapse
 
nseaseb profile image
nseaprotector

Hi, I understand your choice. I really found in love with Elixir / Phoenix / livebook / Ecto / and more ...
Thanks a lot to explain this.
best regards