Previously we described the difference between Elixir and Ruby and the main features. One of the features of Elixir is the ability to work with umbrella projects. With umbrella projects, Elixir allows you to have more than one application in your system. The really nice thing about this is that there is almost no difference between an application inside an umbrella and the same application if it were built as a single project. So, let’s have a look at the benefits of umbrella projects.
One of the positive points in an umbrella project is that it helps you think about your system with a clear separation of logic and responsibilities, which translates to the organization of your code. The definition of components is very clear: the interdependencies between applications and how they relate to each other are transparent and easy to find.
- Scalability. In practice, it is common for umbrella projects to be deployed as a single release. However, Elixir offers the option of having releases per application or a group of applications.
- Umbrella cons. Common external libraries must be added as dependencies and set up in all applications if you want to have them available internally. Common libraries are usually for testing and development, such as Credo, Dialyxir, ExDoc, and ExCoveralls. In other Elixir projects, all applications live in the main mix.exs file.
- Monolith costs. Libraries used for a small part of the application are considered required for the entire system. Any change, small or big, requires a full system deployment.
Microservice costs. Developers and QA have to run all services to fully develop and test. Tracing errors across services is complex as errors in one specific service are local.
Additionally, reducing the need of communication logic between applications is really important when handling many services, as you don’t need to spawn one service per functionality or commingle functionalities in the same service, creating a monolith.
If you are interested in the topic, you can find more here.