Search⌘ K
AI Features

Multi-application Umbrella Projects

Explore how to structure Elixir projects using umbrella projects to split code into multiple applications. Understand creating, compiling, and testing subprojects including custom sigils and evaluators, enhancing your ability to build modular Elixir codebases.

It’s unfortunate that Erlang chose to call self-contained bundles of code applications. In many ways, they’re closer to being shared libraries. And as our projects grow, we may find ourselves wanting to split our code into multiple libraries, or applications.

Fortunately, mix makes this painless. To illustrate the process, we’ll create a simple Elixir evaluator. Given a set of input lines, it’ll return the result of evaluating each. This’ll be one application. To test it, we’ll need to pass in lists of lines. We’ve already written a trivial ~l sigil that creates lists of lines for us, so we’ll make that sigil code into a separate application.

Elixir calls these multi-application (multi-app) projects umbrella projects.

Create an umbrella project

We use mix new to create an umbrella project, passing it the --umbrella option.

$ mix new --umbrella eval 
* creating README.md
* creating mix.exs
* creating apps

Compared to a normal mix project, the umbrella is pretty lightweight with just ...