sasajuric

sasajuric

Author of Elixir In Action

I’d like to announce a small library called boundaries.

This is an experimental project which explores the idea of enforcing boundaries in Elixir projects without requiring the extra ceremony of umbrella apps. You can find a brief explanation on the library repo, while a more detailed doc is available here.

Note that this library is still in an exploratory phase, and I haven’t really tried it out myself yet. At this point I’m opening it primarily to collect the community feedback.

Showing Posts 1 to 10

tcoopman

tcoopman

This looks very nice! I hope to find some time to play with it soon.

One question I had while reading. I was wondering what the reason is that the root module is always exported?

LostKobrakai

LostKobrakai

This is exactly how I imagine boundries to be reasonably enforced and it’s even part of elixir LS.

sasajuric

sasajuric OP

Author of Elixir In Action

There are two reasons. One is mechanical, another conceptual.

The mechanical is that allowing root export to be configurable makes configuration a bit more messy. For example, let’s say we want to export MySystem and MySystem.User. There are two options:

{MySystem, exports: [MySystem, MySystem.User]}

Here, we require that the exported modules are referenced with the full name which makes the configuration more noisy. It can become a significant problem if we’re dealing with 2nd (or 3rd, or 4th, …) level boundaries (which is an addition I’m definitely considering).

Another option is to introduce some sort of special atom such as :this, or :root:

{MySystem, exports: [:root, MySystem.User]}

which looks a bit ugly/hacky to me.

The conceptual problem is that I’m somewhat skeptical that exporting e.g. MySystem.User, while keeping MySystem internal is a good code organization. If you want to have some internal helper functions, I think that using e.g. MySystem.Helpers or some such is a better approach. To be clear, I definitely don’t want boundaries to be highly opinionated and rigid, but given the mechanical issues presented earlier, and this conceptual problem, I currently opted to always export the root module.

In any case, none of the current choices is set in stone, so this decision is definitely up for discussion (in which case perhaps a GH issue would be a better place).

tcoopman

tcoopman

I was just wondering about the the reasons. Both reasons look valid.

Elixir LS has support for boundaries? Where can I read about that?

LostKobrakai

LostKobrakai

Look at the github readme.

sasajuric

sasajuric OP

Author of Elixir In Action

I think that what @LostKobrakai tries to say is that boundaries integrates with ElixirLS, because it’s a mix compiler, and ElixirLS can work with mix. This is mentioned in the boundaries readme near the end:

tcoopman

tcoopman

Ah, now I get it. Thanks. I completely misinterpreted that.

axelson

axelson

Scenic Core Team

First off this is a VERY interesting project! It’s really neat to be able to define enforced boundaries in such a succinct way. A tool like this could help an Elixir project stay in one application for much longer before feeling a need to move to an umbrella or poncho style with multiple applications.

I agree that it makes sense to export the root module by default. But in order to have a flexible tool it would be nice to optionally not export a root module. Perhaps a syntax like this could work:

{MySystem, exports: [MySystem.User], export_root: false}

blatyo

blatyo

Conduit Core Team

Looking at this on my phone, but I didn’t see it mentioned anywhere how this interacts with the standard library and packages. Do they also need to be defined as boundaries? Also, I suspect this wouldn’t catch modules passes as variables? Would it notice you reference a module to store it into a variable?

gshaw

gshaw

This is a great project. I ran it against a small app I’ve been working on and found a couple of useful violations. Definitely think something like this has legs.

If others run into a bug when reporting on .eex files I posted a fix in GitHub.
https://github.com/sasa1977/boundaries/issues/1

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews