# Elixir and Phoenix - The Advantages for Developers

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](/content/docs/elixir/ ""/index.html).

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ć](https://twitter.com/wojtekmach/status/1710020808523846087 "") re-tweet where he shared the following slide from his [GOTO Conference Talk](https://www.youtube.com/watch?v=JvBT4XBdoUE "").

This image enumerates some of the technical requirements that the [Erlang Virtual Machine](https://www.erlang.org/ "") 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](/content/ ""/index.html). 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](/content/phoenix-files/beam-clustering-made-easy/ ""/index.html).
- 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](/content/docs/reference/private-networking/ ""/index.html) 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](https://www.erlang.org/doc/man/ets.html "").
- Tooling for [tracing](https://www.erlang.org/doc/apps/erts/tracing "") and [observing](https://www.erlang.org/doc/man/observer "") 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](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html "") and [Hex](https://hex.pm/ "").
- With modern tooling built in:
   - [Testing](https://hexdocs.pm/ex_unit/1.15/ExUnit.html "")
   - [Documentation](https://github.com/elixir-lang/ex_doc "")
   - Formatting
- Language with a clean, [documented](/content/phoenix-files/elixir-docs-are-built-different/ ""/index.html) and fully exampled [Standard Library](https://hexdocs.pm/elixir/1.15.7/Kernel.html ""). 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](/content/phoenix-files/elixir-docs-are-built-different/ ""/index.html):
   - Built in Cheatsheets
   - Built in Custom Markdown
   - Links to source
   - Search
   - Support for Mermaid, Math.js, Vega-Lite and more!
- Modern language features like:
   - [Protocols](https://elixir-lang.org/getting-started/protocols.html "") enabling high level collections and functions like [Enum](https://hexdocs.pm/elixir/1.15.7/Enum.html ""), [Streams](https://hexdocs.pm/elixir/1.15.7/Stream.html ""), and [Access](https://hexdocs.pm/elixir/1.15.7/Access.html "").
   - [Stream](https://hexdocs.pm/elixir/1.15.7/Stream.html ""), enabling lazy and performant data processing
   - Full featured [Date](https://hexdocs.pm/elixir/1.15.7/Date.html "")/ [Time](https://hexdocs.pm/elixir/1.15.7/Time.html "")/ [DateTime](https://hexdocs.pm/elixir/1.15.7/DateTime.html "")/ [Calendar](https://hexdocs.pm/elixir/1.15.7/Calendar.html "") modules.
   - [Task](https://hexdocs.pm/elixir/1.15.7/Task.html "") for trivial parallel processing.
   - [Agent](https://hexdocs.pm/elixir/1.15.7/Agent.html "") for trivial shared state management.
   - [Config](https://hexdocs.pm/elixir/1.15.7/Config.html "") for environment specific configuration
   - [Registry](https://hexdocs.pm/elixir/1.15.7/Registry.html "") for local, decentralized and scalable key-value process storage.

This is just a subset of what Elixir the Language provides. It doesn’t include the _deep_ catalog of libraries within package registry [Hex](https://hex.pm/ "") enabling so much more.

Some examples from Hex:

- Machine Learning with [Bumblebee](https://github.com/elixir-nx/bumblebee "") with HuggingFace integration and it works with batching and distribution globally.
- Math/Science comparable to NumPy using [Scholar](https://github.com/elixir-nx/scholar "").
- Complex distributed big data processing using [GenStage](https://hexdocs.pm/gen_stage/GenStage.html "") or [Broadway](https://github.com/dashbitco/broadway "")
- Embedded and IoT Programming using [Nerves](https://nerves-project.org/ "").
- [Stream-Data](https://hex.pm/packages/stream_data "") for property and generative based testing.
- [Sobelow](https://hex.pm/packages/sobelow "") for security and static Analysis.
- [Oban](https://hex.pm/packages/oban "") for a Worker/Job Queue implementation.
- [Req](https://hex.pm/packages/req "") for high level HTTP Clients.
- [Plug](https://github.com/elixir-plug/plug/ "") for HTTP Servers.
- [Bandit](https://github.com/mtrudel/bandit "") for pure Elixir HTTP1/2 Server!
- [LiveBook](https://livebook.dev/ "") for Juypter like workbooks with Elixir!
- [Membrane](https://membrane.stream/ "") for video stream processing.
- [Decimal](https://hexdocs.pm/decimal/readme.html "") for arbitrary precision decimal arithmetic.
- [Jason](https://hexdocs.pm/jason/readme.html "") for highly performant JSON Encoding/Decoding.
- [Image](https://hex.pm/packages/image "") for image manipulation.
- [CLDR](https://github.com/elixir-cldr/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](https://github.com/rusterlium/rustler "") and [Zigler](https://github.com/E-xyza/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:

- A fully featured HTTP library with
   - Advanced [Routing](https://hexdocs.pm/phoenix/Phoenix.Router.html "")
   - [Plug-able steps](https://hexdocs.pm/phoenix/Phoenix.Router.html#module-pipelines-and-plugs "")
   - Built in [HTML](https://hexdocs.pm/phoenix/components.html "") and [JSON](https://hexdocs.pm/phoenix/json_and_apis.html "") handling
   - With [HTTPS](https://hexdocs.pm/phoenix/using_ssl.html "") with sane security defaults
   - [Secure Cookie Sessions](https://hexdocs.pm/phoenix/mix_phx_gen_auth.html#tracking-sessions "")
   - [Secure Tokens](https://hexdocs.pm/phoenix/Phoenix.Token.html "")
   - [Controller](https://hexdocs.pm/phoenix/controllers.html "") Actions for MVC Style apps.
   - Built in [Internationalization Tooling](https://hexdocs.pm/gettext/Gettext.html "")
- Websockets with
   - [Multiplexing](https://hexdocs.pm/phoenix/channels.html "") via Channels
   - JavaScript library that handles backoff and common error modes
   - Serialization
   - [Sessions](https://hexdocs.pm/phoenix/Phoenix.Socket.html#module-socket-fields "")
   - [Scalable to millions of clients.](https://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections "")
   - [PubSub](https://hexdocs.pm/phoenix_pubsub/Phoenix.PubSub.html "") Fully Distributed
   - With optimizations for “hot paths”
   - [Presence](https://hexdocs.pm/phoenix/Phoenix.Presence.html "") Monitoring and tracking _who_ is in a channel
   - Fully Distributed
   - Built using CRDT’s
   - JavaScript support
- Development Tooling:
   - [Live Code Reloading](https://hexdocs.pm/phoenix/Phoenix.CodeReloader.html "")
   - [Helpful and actionable](https://hexdocs.pm/plug/Plug.Debugger.html "") Errors
   - Built in End to End Testing. (No Chromedriver needed)
- JavaScript
   - Bundling/Minification/Integrity/Cache Busting
     - Using [esbuild](https://hex.pm/packages/esbuild "") that is installed for you
   - NPM support
   - Custom JS is trivial
- CSS via Tailwind
   - Bundling/Minification/Integrity/Cache Busting
     - Using [tailwind](https://hex.pm/packages/tailwind "") that is installed for you
   - Custom CSS is trivial
- [LiveView](https://hexdocs.pm/phoenix_live_view/welcome.html "")  
   - Simple, server rendered Live HTML and CSS, in pure Elixir.
   - HTML and Html Attribute Compile Time [Verification](https://hexdocs.pm/phoenix/components.html#heex "")
   - [Highly Optimized](https://dashbit.co/blog/latency-rendering-liveview "") for the modern web
   - Debug tooling for Dev
   - [JS Interop](https://hexdocs.pm/phoenix_live_view/js-interop.html "") is Trivial
   - [Latency Simulation](https://hexdocs.pm/phoenix_live_view/js-interop.html#simulating-latency "")
   - [Single BEAM Process](/content/phoenix-files/a-liveview-is-a-process/ ""/index.html) per connection
   - Trivial [File Uploads](https://hexdocs.pm/phoenix/file_uploads.html "") to disk or the cloud.
- Databases with [Ecto](https://hexdocs.pm/ecto/Ecto.html "")
   - [Postgres/MySQL](https://github.com/elixir-ecto/ecto_sql "")/ [Sqlite](https://github.com/elixir-sqlite/ecto_sqlite3 "")/and [more](https://hex.pm/packages?search=ecto&sort=recent_downloads "")
   - [Full Query DSL](https://hexdocs.pm/ecto/Ecto.Query.html "") with [Raw SQL](https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.html#query!/4 "") escape [hatch](https://hexdocs.pm/ecto/Ecto.Query.html#module-fragments "")
   - [Migrations Up/Down/Schema dump](https://hexdocs.pm/ecto_sql/Ecto.Migration.html "")
   - [Full Schema](https://hexdocs.pm/ecto/Ecto.Schema.html "") and [Change](https://hexdocs.pm/ecto/Ecto.Changeset.html "") Validation
   - [Transaction](https://hexdocs.pm/ecto/Ecto.Repo.html#transaction-api "") Support
   - [Multi-step](https://hexdocs.pm/ecto/Ecto.Multi.html "") Queries/Transactions
- [Full Authorization/Authentication generator](https://hexdocs.pm/phoenix/mix_phx_gen_auth.html "")
   - Register, Login, Forgot Password, Email Verification and Sessions
   - LiveView or Server HTML
- [Email Rendering and Sending](https://github.com/swoosh/swoosh "")
- Built in [Metrics Tracking](https://hexdocs.pm/phoenix/telemetry.html#metrics "")
- Single Line to add a full [Metrics Dashboard](https://github.com/phoenixframework/phoenix_live_dashboard "")
- [Dockerfile generator](https://hexdocs.pm/phoenix/releases.html#containers "")

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](https://livebook.dev/ "") or [Natively](https://elixir-lang.org/install.html#by-operating-system "")!

## 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! →](/content/docs/elixir/index.html)
