Creating precompile library

How to create Elixir library contains compiled beams instead of source code?

Hi - this topic covers your question pretty comprehensively I think:

TLDR; There is no real support for this, but you can restrict access to libraries through private packages on hex.

1 Like

I think binary packages would be (more) useful for other things, than avoiding to expose source code: They could be used to split up the build process, such that libraries are being build independently of the application(s) using it. It also allows binary packages to be stored in an artifact repository and ensure that only those specific artifacts are used when building the final application(s).

I believe this is quite common in other language environments. It does, however, come with quite a few limits with regards to how the library can be configured and binary file compatibility (both Beam and native). So, even if it was possible, I’m not completely sure how widely it will be applicable.


I need to distribute core of my system as compiled artifacts (Phoenix API endpoint is one of them). In discussion mentioned by @mindok I found my current, temporary or not, solution. I’m distributing core as separate beam node with is connected to something like plug-in node for that but I’m not shure is valid and efficient soluton