Overview of Elixir

This is meant to give you an orientation of Elixir, major frameworks, libraries, parts and how they relate to each other. It doesn't aspire to teach you Elixir. I found the guide on the language site to be quite good for that.

Elixir

Elixir is a programming language. The code you write in it compiles to bytecode for the BEAM (more on the BEAM later). The biggest difference for a lot of people encountering Elixir for the first time will be that it isn't an object-oriented language. It is a functional language which means there are some important differences when programming in it compared to most popular languages. Elixir has had a lot of work done to make it very easy to use and approachable so it is quite easy to get going with. Elixir has a spiritual and to some extent stylistic heritage from Ruby. The creator, José Valim, was active in the Ruby community before creating Elixir and brought a lot with him from that. This is why Ruby and Ruby on Rails often comes up in discussions around Elixir. This also means a lot of Elixir developers came from the Ruby community. I did not, I was mostly using Python.

BEAM

The BEAM or BEAM VM is a virtual machine. A virtual machine is usually used to make it easier to make a programming language work on many different platforms. It means that there is a program, the VM, that reads a specific type of code. When starting on a new platform you just implement the VM for that platform and you can probably run all code compiled for that VM. The truth is usually a bit more nuanced and there are other advantages and disadvantages to a VM.

There are a few languages that compile for the BEAM. The ones I've paid any attention to are Elixir, Erlang and Gleam.

The BEAM was created for Erlang.

Erlang & OTP

The original programming langauge for the BEAM was created at Ericsson. It was open sourced at a certain point and has enjoyed a niche following and successful use since. Erlang is basically inseperable from OTP, the Open Telecom Platform, which was originally developed to run critical telecom infrastructure at Ericsson in a reliable way. So Erlang and the BEAM are built with soft real-time capabilities, a strong reliability strategy, clustering and even hot code updates.

Erlang has seen adoption in some high-profile use-cases even before Elixir was exploding onto the scene. Whatsapp has used it to great success for example. Klarna, the gigantic payment processor, has also made a strong bet on Erlang.

Elixir is built partially in Erlang and can use Erlang code. Erlang can also use Elixir code from what I gather, I haven't tried it.

Gleam

Another language, bringing a stronger type system to the table. Also compiles to run on the BEAM. Still in early development, but quite active at the time of writing.

Phoenix

The Rails, Django, Laravel of Elixir. It is a web framework for building web applications. I would claim it is less opinionated than Rails or Django but still opinionated enough to give quite the running start to a developer.

It provides mostly the normal features you'd expect along with some slightly more BEAM-related ones. Phoenix PubSub for example is used for internally passing messages in a Publish/Subscribe pattern. On top of that Phoenix provides Channels which allows developers some solid conveniences on top of WebSockets for real time data.

Phoenix Presence

Significantly more complex under the hood but fairly simple to use. Phoenix Presence allows a developer to implement presence in a distributed fashion in their application. Presence in this case means things like tracking if a user is online, from which devices or in which chat rooms. For most cases this could be quite simple but Presence is built to scale across a distributed system and uses CRDTs and such fanciness to create consistency in a complex system.

Phoenix LiveView

The recent hotness at the time of writing. LiveView allows building stateful and dynamic UI without writing Javascript code to achieve it. It manages all of it on the backend and updates are performed via Phoenix Channels. LiveView is an extremely impressive project that takes good advantage of what the BEAM offers. It is both an easier way than going in-depth with Javascript, as well as being a fairly complex topic. I recommend checking out a video of one of Chris McCord talks on the subject for more details.

Ecto

The most well-known database library in Elixir. It is the default DB-library for Phoenix. It has some novel ideas compared to a straight-up ORM. The Ecto library provides schema definitions, changesets and a bunch more. The Ecto SQL library contains the remaining stuff for using Ecto specifically with databases. You can use Ecto without a database to use Schemas and changesets to use the validation functionality for example. The SQL part has additional libraries that help it integrate with a number of different SQL DBMS:es and even some non-SQL ones.

Nerves

If you are interested in hardware or Internet of Things (IoT) you should check out Nerves. It is a system of libraries, a toolchain and a bunch more to allow building tight Linux-based Elixir systems in a reliable and convenient way with a focus on hardware. It also helps solve how to keep IoT-devices safe and up to date with the NervesHub project.

Scenic

Scenic allows us to build OpenGL-based fast, efficient and lightweigt UI without shipping a web-browser while only writing Elixir. It is an amazing project and very interesting. It works well with Nerves in general but can also be used for desktop applications.