Best practice for building a library as an optional application?

I’m building a library that could be used as either a straight API – or could be supervised as an application such that it could cache values in :ets, etc.

Are there any good examples or recommended ways to cleanly support both paths?

Thanks for any suggestions!
Scott S.

:wave:

I’d add a module with a child_spec which could be added to the user’s supervision tree. This way the user would be in full control of when and how to start your app’s process tree.

4 Likes

Other then what @idi527 said you can also follow these guidelines for libraries:

https://hexdocs.pm/elixir/master/library-guidelines.html