Elixir and Phoenix can do it all!

A fly bird wearing indiana jones clothing, in an ancient tomb discovering elixir and a lightsaber.
Image by Annie Ruygt

We’re Fly.io. We run apps for our users on hardware we host around the world. Fly.io happens to be a great place to run Phoenix applications. Check out how to get started!

As an Elixir/Phoenix developer going on 10 years it is very easy to take for granted everything that Elixir and Phoenix can do for us. So I wanted to take a step back and list all of the stuff that we get for free when we choose Elixir and Phoenix.

My goal with this post is dump an list of information and links and let you choose your own path. If you are unfamiliar with any of these topics or Elixir and Phoenix please click any of these links and take a peak, I think you might be surprised at the quality and depth of what you find!

The inspiration for this post was a Saša Jurić re-tweet where he shared the following slide from his GOTO Conference Talk.

This image enumerates some of the technical requirements that the Erlang Virtual Machine can replace in your tech stack. Not to say that these other projects can’t do these things well, they can and do in our own stack here at Fly.io. The point is that in those ecosystems you have to solve these problems in the first place, when reviewing this article José Valim said it best:

removing the problem altogether instead of solving the problem

The BEAM

This above list doesn’t even cover the built in support for incredible bits like:

  • Actor Process Model, meaning due to concurrency you have a Process and it sends messages to other processes. No Shared memory. Fully managed by the BEAM’s built in scheduler. Millions of processes are no issue. Fearless concurrency!
  • Distribution: meaning two servers can communicate seamlessly and automatically. It just works and is incredible.
  • RPC: Calling a function or process remotely is as easy as calling a local one, no need to concern ourselves with connections or serialization or deserialization. This is one of the many reasons Fly is so committed to using Elixir and Phoenix, the wireguard based network and globally hosting makes using this trivial and desirable.
  • Parallel Garbage Collection, meaning the VM is Soft Real Time, minimal pausing!
  • Emphasis on low resource usage in general
  • Built in UDP/TCP/SSL server support.
  • Built in Key Value Store ETS.
  • Tooling for tracing and observing your code.
  • 37 Years of constant development and production use.

The beauty of this list is that if Elixir and Phoenix team have done our Job right you don’t need to think about any of this at all. It just works for you and lets you stand on the shoulders of this giant.

Elixir

If we go higher level the Elixir programming language provides us even more as developers:

  • A full dependency management and build tool with mix and Hex.
  • With modern tooling built in:
  • Language with a clean, documented and fully exampled Standard Library. Its remarkable how little cruft there is in this Language. Go into any other language to find random functions or modules that are marked do not use, or without examples or documentation. Not the case for Elixir.
  • Modern Documentation:
    • Built in Cheatsheets
    • Built in Custom Markdown
    • Links to source
    • Search
    • Support for Mermaid, Math.js, Vega-Lite and more!
  • Modern language features like:

This is just a subset of what Elixir the Language provides. It doesn’t include the deep catalog of libraries within package registry Hex enabling so much more.

Some examples from Hex:

  • Machine Learning with Bumblebee with HuggingFace integration and it works with batching and distribution globally.
  • Math/Science comparable to NumPy using Scholar.
  • Complex distributed big data processing using GenStage or Broadway
  • Embedded and IoT Programming using Nerves.
  • Stream-Data for property and generative based testing.
  • Sobelow for security and static Analysis.
  • Oban for a Worker/Job Queue implementation.
  • Req for high level HTTP Clients.
  • Plug for HTTP Servers.
  • Bandit for pure Elixir HTTP1/2 Server!
  • LiveBook for Juypter like workbooks with Elixir!
  • Membrane for video stream processing.
  • Decimal for arbitrary precision decimal arithmetic.
  • Jason for highly performant JSON Encoding/Decoding.
  • Image for image manipulation.
  • CLDR for maybe the most complete Internationalization and Locale libraries outside of maybe the Web Browser. Numbers, List, Units, Date\Time\DateTimes, Collation, Territories, and more.
  • Rustler and Zigler for truly simple Rust and Zig FFI support, for when you need to drop down and bash bits.

There is very little that the Elixir Ecosystem hasn’t tackled!

Phoenix and LiveView

The fun doesn’t stop there because Phoenix simply builds on all of his incredible tooling to provide us with:

Just going through this list there is everything you’d need to start a company or build a website to solve nearly any problem. Coupled with the BEAM’s ability to scale from the smallest server to a globally distributed network with millions of customers on every continent! I may sound a little breathless but I am out of a breath just collating all of these links.

Wrap up

Stepping back it’s incredible that a small team is able to accomplish so much. Every one of Phoenix’s incredible features is built on the shoulders of the fantastic Elixir project underneath. Further backed by 37 years of constant development by the Erlang project.

If you haven’t looked into Phoenix or Elixir I urge you to explore any one of the above links that catch your eye. Installing and setting up Elixir has never been easier with LiveBook or Natively!

Fly.io ❤️ Elixir

Fly.io is a great way to run your Phoenix LiveView apps. It’s really easy to get started. You can be running in minutes.

Deploy a Phoenix app today!