When you first start developing in Elixir it’s hard to track down the best libraries, so here’s my pick after 6 months of Elixir’ing at Drover:
Ecto is the equivalent to Rails’ ActiveRecord. It handles connections to a database, as well as migrations and all that jazz.
Phoenix is Elixir’s more direct equivalent to Rails. It implements the server-side Model View Controller (MVC) pattern and should feel familiar to all Rails devs.
Broadway is a library that allows you to easily build data processing pipelines in Elixir. It’s data production agnostic and the most common case is to use it with broadway_sqs to consume and process messages from SQS queues (it also supports RabbitMQ and is easily extended).
If you need a token based authentication mechanism then Guardian is for you. By default JSON Web Tokens are supported out of the box but any token that implements Guardian.Token behaviour can be used.
Speaking of authentication, if you need to provide multiple ways to auth your app — including social login and signup — you probably want something like Ueberauth. Heavily inspired by Omniauth, it allows for many authentication strategies to be used.
Telemetry is a metrics and instrumentation dispatching library. It’s a joint effort by the Erlang community to provide metrics for Erlang and Elixir projects.
Being a dynamic language, types can become tricky in Elixir. The good news is that projects like Norm can help you specify and structure your data to make it conform to any values you expect. Using `conform!` is a great way to assert data structure inside your functions.
Thwarting abusive web requests is a must nowadays. And you can use PlugAttack for that. It’s inspired by the Rack::Attack middleware for Ruby.
Date and time handling in Elixir/Erlang is not the most usable thing in the world. Thankfully there are libraries like Timex that can help. If you need to manipulate dates, times, datetimes, timestamps, etc., (timezone support included) then Timex is for you.
CORSPlug is a library to provide CORS support as a plug (that can be used in Phoenix), so that different systems can easily interact with your API, even from another domain.
Bonus track: documentation, development and test tools
Here’s a few more libraries, this time dedicated to development time, documentation and testing:
PhoenixSwagger gives you a way to generate Swagger documentation for Phoenix apps. It can also serve a web interface to browse and interact with API documentation that you generate. A must, if you are developing a web API.
If you love to have your code well documented, EXDoc allows you to generate HTML and EPUB docs for it.
Mix Test Watch runs your project tests whenever you change a file. You never need to run tests manually ever again. It’s that awesome.
The perfect complement to that is ExUnitNotifier, which shows you desktop notifications when the tests run with information about pass or fail. You don’t even need to leave your IDE to know if you broke something or not.
Speaking of static analysis, Dialyzer is a static analysis tool for Erlang and other languages that compile to BEAM byte code for the Erlang VM. It can analyse the BEAM files and provide warnings about problems in your code including type mismatches and other issues that are commonly detected by static language compilers. You can use Dialyxir to simplify using the Dialyzer in Elixir projects.
You probably heard of Brakeman, a security focused gem that analyses your code for vulnerabilities. For Elixir you have Sobelow.
If you have any suggestions about other interesting libraries, feel free to share in the comments below.