Elixir is an open source, functional, dynamic language with a strong emphasis on concurrency and fault tolerance. It runs on the Erlang virtual machine (BEAM). Elixir builds on top of Erlang and shares the same abstractions for building distributed, fault-tolerant applications.
Many frameworks have been developed on top of Elixir to take advantage of the beautiful syntax as well as the power of Erlang. Most of them are built for specific use-cases like system-level tools, APIs, web frameworks etc. Those frameworks provide higher-level abstractions to Elixir developers which makes it easier to create large web application backend.
Here is a curated list of the most useful and popular frameworks on Elixir with detailed information about the purpose, docs, release date etc. These frameworks include Phoenix, Hedwig, Nerves, Sugar, Trot, Anubis and many more.
1. Phoenix Framework - Web & API
- URL: http://phoenixframework.org/
- Github: https://github.com/phoenixframework/phoenix
- Docs: https://hexdocs.pm/phoenix/Phoenix.html
- Released in: 2014
- Purpose: Web Applications, API Backends, Soft Real Time Systems, Messaging Applications
Phoenix brings back the simplicity and joy in writing modern web applications by mixing tried and true technologies with a fresh breeze of functional ideas. Phoenix leverages the Erlang VM ability to handle millions of connections alongside Elixir's beautiful syntax and productive tooling for building fault-tolerant systems.
Phoenix provides the best of both worlds - high developer productivity and high application performance. It also has some interesting new twists like channels for implementing realtime features and pre-compiled templates for blazing speed.
Phoenix is made up of a number of distinct parts, each with its own purpose and role to play in building a web application such as: - Controllers - Endpoint - Routers - Views - Channels - Templates
2. Nerves - IoT & Embedded Software
With Nerves, one can craft and deploy bulletproof embedded software in Elixir. It takes care of the network, discovery, I/O, firmware updates and more. It can also get pack the whole application into as little as 12MB and have it start in seconds by booting a lean cross-compiled Linux directly to the battle-hardened Erlang VM.
Nerves define an entirely new way to build embedded systems using Elixir. It is specifically designed for embedded systems, not desktop or server systems. You can think of Nerves as containing three parts:
- Platform - a customized, minimal Buildroot-derived Linux that boots directly to the BEAM VM.
- Framework - ready-to-go library of Elixir modules to get you up and running quickly.
- Tooling - powerful command-line tools to manage builds, update the firmware, configure devices, and more.
Taken together, the Nerves platform, framework, and tooling provide a highly specialized environment for using Elixir to build advanced embedded devices.
3. Sugar - Web Framework
- URL: https://sugar-framework.github.io/
- Github: https://github.com/sugar-framework/sugar
- Released: 2014
- Docs: https://sugar-framework.github.io/docs/
Sugar is a modular web framework for Elixir. It aims to be a strong contender for web development. Sugar has 3 goals: - Speed. Sugar shouldn't be slow and neither should your project. - Ease. Sugar should be simple because simple is easy to learn and use. - Effective. Sugar should aid development. You have better things to which to devote your time.
4. Hedwig - Bot Creation Framework
- Github: https://github.com/hedwig-im/hedwig
- Docs: https://hexdocs.pm/hedwig/readme.html
- Released: 2015
Hedwig is a chat bot, highly inspired by GitHub’s Hubot. It was designed to run as a single, stand-alone OTP application or can be included with OTP application as a dependency. It's great for testing how your bot will respond to the messages it receives.
Hedwig comes with many adapters: - IRC - A IRC Adapter - Facebook Messenger - A Facebook Messenger Adapter (WIP) - Flowdock - A Flowdock Adapter - SendSonar - A SendSonar Adapter (WIP) - Slack - A Slack Adapter - SMS - A SMS Adapter powered by Twilio - XMPP - A XMPP Adapter
Hegwig also has support for a list of responders ranging from YouTube, Weather, Mopidy, etc. One can find a list of all resources at https://github.com/enilsen16/awesome-hedwig
5 Plug - Web
- Github: https://github.com/elixir-plug/plug
- Released: 2015
- Docs: https://hexdocs.pm/plug/readme.html
In the Elixir world, Plug is the specification that enables different frameworks to talk to different web servers in the Erlang VM. Plug as a piece of code that receives a data structure, does some sort of transformation, and returns this same data structure, slightly modified. This data structure that a Plug receives and returns is usually called connection and represents everything that there is to know about a request.
- Plug is a specification for composable modules between web applications
- Connection adapters for different web servers in the Erlang VM
6. Trot - Web
- Github: https://github.com/hexedpackets/trot
- Released: 2015
- Docs: https://github.com/hexedpackets/trot, https://hexdocs.pm/trot/0.3.0/
Trot is an Elixir web micro-framework heavily inspired by Sinatra and Flask. It based on Plug and Cowboy. The goal of Trot is to make common patterns in Plug easier to use, particularly when writing APIs, without sacrificing flexibility. Trot provides conveniences for many common patterns while being able to easily drop down into pure Plug when necessary for more complex handling.
Key features: - Template rendering using EEx or Calliope (HAML) - Handling for versioned APIs - Automatic JSON response parsing - Pattern match routes using request headers, API version, or host - Interoperability with Plug
Elixir also has some frameworks which are not as popular or large due to their specific purpose oriented nature. The contributors for these projects might be less but I found these frameworks quite handy and useful in their own domain.
7. Placid - API
- Github: https://github.com/slogsdon/placid
- Released: 2014
- Docs: https://hexdocs.pm/placid/readme.html
A REST toolkit for building highly-scalable and fault-tolerant HTTP APIs with Elixir. By default, connecting to a Placid-based API will require all requests to be made over HTTPS, responding to HTTP requests with a 403 Forbidden. If desired, the https_only option may be set allow HTTP requests to be served by your application.
Placid provides modules like Routing, rendering, request handlers, Internationalization, etc.
8. Kitto - Interactive Dashboard Framework
- URL: https://kitto.io/dashboards/sample
- Github: https://github.com/kittoframework/kitto
- Released: 2016
- Docs: https://github.com/kittoframework/kitto/wiki , https://hexdocs.pm/kitto/api-reference.html
Kitto is a framework for interactive dashboards written in Elixir. Kitto allows to run jobs concurrently as supervised processes. Widgets are coded in the popular React library.
Highlights: - Allows streaming SSE to numerous clients concurrently with low memory/CPU footprint - Easy to deploy using the provided Docker images, Heroku (guide) or Distillery (guide). Can serve assets in production - Keeps stats about defined jobs and comes with a dashboard to monitor them (demo) - Can apply exponential back-offs to failing jobs - Reloads code upon change in development
9.Maru - REST API
Maru is a REST-like API framework for elixir inspired by grape. It's designed to run on plug or complement existing web application frameworks such as Phoenix by providing a simple DSL to easily develop RESTful APIs.
Features: - Grape-like DSL for routing HTTP requests - Parameter validation and coercion - Versioning - Process response - Supplementary unit test
10. Anubis - Command Line Application Framework
- Github: https://github.com/BennyHallett/anubis
- Docs: https://github.com/BennyHallett/anubis
- Released: 2014
Anubis is a library for creating command line applications in Elixir. Anubis allows you to create command line applications with multiple commands (like git), without needing to define multiple mix tasks. This can be useful when exporting your command line application as an escript.
Anubis makes defining which switches are valid and what their types are quite simple. Once commands are defined, Anubis will automatically generate a help command, which lists out the available commands and their descriptions, along with what switches are available.
11. Urna - DSL for REST Services
- Github: https://github.com/meh/urna
- Released: 2014
Urna is a simple DSL around cauldron to implement REST services. Urna tries to follow the REST style as closely as possible, there are namespaces and resources, and standard requests to these resources will receive proper answers.
It includes OPTIONS requests being properly processed, requests on non-existent resources being answered with 404 and verbs not implemented for the resource being answered with a 405.
12. Flowex - Flow-Based Programming Framework
- Github: https://github.com/antonmi/flowex
- Docs: https://hexdocs.pm/flowex/api-reference.html
- Released: 2016
Flowex is a set of abstractions built on top Elixir GenStage which allows writing program with Flow-Based Programming paradigm. It is a mix of FBP and so-called Railway Oriented Programming (ROP) approach. Flowex DSL allows you to easily create "pipelines" of Elixir GenStages.
The “Railway Oriented Programming” pattern in functional programming presents a program as a pipeline of functions (output of one function is an input for another).
Elixir is relatively new programming language but it has gained a lot of traction in the last couple of years. The community is not as huge as Ruby or Python, but as much passionate, helpful and make decisions which are very pragmatic.
If someone is new to Elixir ecosystem and not sure which framework to start with, I would suggest going with Phoenix as there are a lot of resources (tutorials, articles, sample applications) available to get started. It has become very popular specifically for creating web applications and APIs.