Flask/Python Web Framework vs Elixir-Phoenix

Hello, I’m a hobbyist python developer and I’ve been using Flask in creating web API’s. I recently heard about the Phoenix Framework on Elixir and I’ve read that it’s built on top of Elixir which according to my research has good performance when it comes to speed and concurrency. I’ve been searching for some benchmarks but I don’t really trust them since I think they don’t really give justice when it comes to real world performance.

I would like to ask if any of you has experience with both Flask and Phoenix? What are the pros and cons? I’m doing a bit of research since I am about to build a project which expects more traffic than what I used to build and I’m considering building it with of Phoenix and Elixir. Thank you!

(I’ve already done some basic elixir and I’m looking to buy books/enroll in courses if I see it fit)

1 Like

IMO Phoenix is more like Django or Rails while Flask is more of a Sinatra for Ruby and you would be able to achieve this with plug and cowboy in Elixir.


Python is fast and is easy, but will never match the BEAM robustness to handle traffic at scale.

And don’t take my word for it, instead you should watch this video by @sasajuric:

The video will show you all the power of the BEAM, aka the power sitting below Elixir, and you will understand why you can build very robust applications when properly using the BEAM.

Elixir is a functional programming language, thus for us developers coming from other paradigms it may be difficult to properly leverage it, therefore we need to train our brains to do the shift, and the only thing that worked/clicked for me was the book and video course from @pragdave(one of the authors of the Pragramatic Programmer book). I have done both, but you just need to pick one of them to get the excellent training for shifting you to the way of thinking functional with Elixir. Also, in his book or video you will learn how to properly separate code responsibilities to keep it clean and organized in way that can be easily reusable.

Next, I would recommend you to get in more depth how you code for the BEAM ecosystem to leverage message passing and supervision trees to keep your system robust and self healing. For this I recommend you the book from @sasajuric:

I am at half of the Elixir in action book, and I can really recommend it, and my next one on the list is from @JEG2:

This book has lots of praise from the Elixir community, therefore I am really looking forward to start with it.

The bottom line message here is that is very easy to code in Elixir and have a fast API or web app, but is harder to properly master the underline ecosystem and take full advantage of it without spending sometime educating ourselves from the best resources available.


Python is fast and is easy, but will never match the BEAM robustness to handle traffic at scale.

Yes, I’ve heard of how BEAM used to handle truckloads of telephone traffic in the past. That’s why I’m thinking of building my next project in elixir considering scalability and reliability in the foreseeable future.

The other resources you linked were very helpful and insightful, I’ll make sure to take a look at them. Thank you so much!


Thank you! I’ll take a look at these libraries

As books and sources for Elixir/Phoenix/OTP have been posted, I’ll talk about the web frameworks here.
I’ve worked with Flask and Django as well as Phoenix. Here’s my take on all three:

Flask: it’s super light weight in that it ships with very little included. You can bring up a simple web app in no time and gives you full control over as much as you like. That being said there’s a lot of libraries you can selectively include to do some of the repetitive tasks for you.

Django: Django does it all. It’s not “light weight” but that doesn’t mean it’s slow. It has everything you need to write web applications and comes with admin panels, DB query library, authentication etc. If you want to write something more than a simple API or web page, I’d opt for Django. Of course the boundry of “simple” will vary from case to case.

Phoenix: Phoenix is more like Django than Flask in that it includes a more features out of the box. It doesn’t, by default, include an admin dashboard though for example, but it does come with Ecto for example. Your biggest challenge will be adjusting to function programming and Elixir itself, which has nothing to do with Phoenix per se.

I personally find deploying Python apps cumbersome. You can develop with the dev server but to deploy you need to setup nginx as a proxy server and run the application through gunicorn or something similar.
Phoenix you can just deploy and run. It is production ready. You might want to proxy it through nginx still for various reasons, but you don’t have to.

Liveview for Phoenix also just pure magic, and Django channels don’t come close to how amazing live view is.

As for performance, I’d give that to Elixir, especially if you’re not looking to tune deployment. You can mock up a few example applications and use https://locust.io/ to do some load testing. Python’s performance greatly depends on how you set up gunicorn (or other) as well.

If you’re looking for utilities/libraries to take some of the burden’s of development away, Django and Flask probably offer more choice (which can also be a bad thing depending on how you see it). For example creating a REST API in Flask Django can be simplified with frameworks like Django Rest Framework or Flask Restless, for which I don’t believe there is a Phoenix equivalent (I could be wrong).


I guess part of the question is how you’d go about creating quick and lightweight API project, the way you used to do in Flask and Sinatra, more or less “single file approach”, at least at initial stages.

Phoenix may be a bit of overkill for this. So what would you actually use? I’d be curious myself.

I know there was Dynamo, but that seems to be dead. Is there an heir to that? GitHub - dynamo/dynamo: Run, Dynamo, Run!

1 Like

Phoenix would be quite well suited for a simple API. Creating a new project with

mix phoenix.new rest_api --no-brunch

would set you up nicely. One controller would be responsible for the REST interface. You’d need to create the model as well, but a tutorial like this should get you started even if it is a little old.



For a few years, my main job was working with Flask web apps. I have worked on ~15 or so and my summary is that it is easy to use and easy to start with but modern techniques, like Websockets, are not trivial in Flask. I would recommend Python for a beginner programmer with very little experience because Python is easy to read and widely used. However I would actually not recommend Flask. I think something like Falcon (GitHub - falconry/falcon: The no-nonsense, minimalist REST and app backend framework for Python developers, with a focus on reliability, correctness, and performance at scale.) is a better bet.

If you are concerned about performance. or if you want to still be maintaining your site/API in 2 years, I strongly recommend learning Elixir and Phoenix. The learning curve can seem steep, especially if you don’t have a Ruby background (which I lacked, when I started learning Elixir/Phoenix) but when it “clicks”, it is very rewarding.

I work 100% on the PETAL (Phoenix/Elixir) stack these days and I am happy that I don’t have to write or maintain any more Flask apps. I am still learning the basics like OTP but at the same time I am able to work on enterprise-grade applications because Phoenix does a brilliant job of abstracting (without hiding) the “underlying ecosystem”.

* This is just my opinion, and I have no evidence to back it up.


Nowadays is --no-webpack.

But probably for the API it would be best to go with:

mix phx.new rest_api --no-webpack --no-html --no-dashboard 

If not using translations then you can add --no-gettex to the above command.

If not using Ecto, then you can also add --no-ecto to the above command.

Full options available with:

mix help phx.new

I think is a disadvantage to know it, because people will try to mirror how they do it in Ruby, and Elixir is not to be coded in a Object Orientated approach. While you can do it, then you will never leverage the full power of message passing and supervision trees to get a robust and self-healing application.


Lucky me :slight_smile:

1 Like

Thanks for this, aside from performance, it seems that working with Phoenix/Elixir is more maintainable. Great insights!

What’s the TAL in the stack?

PETAL = Phoenix Elixir TailwindCSS AlpineJs LiveView


Let’s not also forget deployment story… Deploying django correctly is not easy. You’ll probably need uwsgi, nginx, at the minimum (maybe you can ingress into your vpc using amazon route 54?). If you’re going any tasks you’ll need celery. For development on your laptop you’ll need venv (or maybe the kids use poetry these days?). God help you if you screw up your venv config.

None of that mess for elixir.


I think the main reason to use Phoenix is websockets (Phoenix Channels) and the ability to communicate between processes (using broadcast). Python would have a hard time competing with Elixir on this front.

If you don’t need these features then both frameworks are comparable, so it really boils down to personal preference then.

1 Like

Yeah, I agree with the part in Python development/deployment, developing is really fast and easy but I hate them when it comes to deployment. Also, even if writing in pure FP is quite hard to adapt, I find it teaching me to become a better developer.

Thanks for thism, https://locust.io/ is an interesting find in this comment.

1 Like

Django Channels provides a websocket implementation which is easy to use. On the broadcast front though I do believe that Django is lacking.

As someone who spent 5+ years building and deploying Flask apps and then tried to get into Elixir / Phoenix I would say the biggest difference is the lack of official libraries from vendors in Elixir.

Depending on what you’re building this might not be a big deal but most apps I build end up requiring payments and right now that situation in Elixir is light years behind Python.

Stripe, BrainTree and Paddle all have very good Python support with official clients, tons of docs and tons of implementation resources on the internet.

With Elixir you’ll have to implement all of this stuff on your own. The 3rd party library world for this isn’t too hot either. Basically depending on what you’re doing this could add months of dev time to your project where you get all of that for free immediately with Python.

I wouldn’t worry too much about the real-time stuff either. With Hotwire Turbo being a thing, it’s quite easy to get partial page updates going and other real-time components in any tech stack (Flask included). I’ve implemented some of that in Flask apps already and it was great both from both a performance and development experience POV.