Why Boundary?
Boundary by Saša Jurić:
Boundary is a library which helps managing and restraining cross-module dependencies in Elixir projects. A few examples of the things you can do with boundary include:
- Prevent invocations from the context layer to the web layer
- Prevent invocations from the web layer to internal context modules
- Prevent usage of Phoenix and Plug in the context layer
- Limit usage of Ecto in the web layer to only Ecto.Changeset
- Allow :mix modules to be used only at compile time
Restricting certain layers of your application from calling each other can make your application easier to change, but it can also help reduce incremental compile time. Have you ever changed a couple lines in a LiveView and had to wait for 43 files to compile? Boundary can save you from that pain.
When Boundary?
You can add Boundary to your application at any time, but it is far easier to add it from the very beginning. Just do it. If it doesn’t work out for you, it’s very easy to remove. Installation instructions.