Packages and Hex
Share code between apps with local path packages. Erlang, JavaScript, and AtomVM can pull Selm libraries from Hex (Erlang can also pull BEAM Hex packages).
Local packages
A path dependency points at another folder that has its own selm.toml. Declare it under [dependencies], then import modules by name:
[dependencies]
ui = { path = "../ui" }import Ui.Counter exposing (page)A browser app (JavaScript target or [client].entry) can import it too: selm make adds the package's src to the generated elm.json source-directories. The todo and counter examples show the pattern.
Path values must be relative and stay inside the workspace jail (the nearest .git ancestor, or a capped parent of the project). Absolute paths and home-directory shortcuts are refused.
Hex dependencies
Hex packages live in the same [dependencies] table. Use Hex version requirements such as ~> 2.20.0. Private organization packages use a small table:
[dependencies]
cowboy = "~> 2.20.0"
thoas = "~> 1.2.0"
jason = "~> 1.4"
secret = { version = "~> 1.0", organization = "acme" }selm deps and selm make pick the newest non-retired matching release, record the full requirement closure in selm.lock, download it from hex.pm, and compile it. Extra lock entries that are not reachable from your declared roots are refused. Community Elm packages (for example elm-explorations/webgl) pin exact versions and zip SHA-1s under the lock's "elm" section and install into project elm-stuff (not shared $ELM_HOME). Browser, Html, Http, and the rest of Elm's official packages ship with selm, so they never appear in the lock.
Hex packages with NIFs run publisher rebar3 scripts. Selm adapters such as esqlite (for Repo.sqlite) are allowed automatically when listed under [dependencies]; any other NIF package needs [native] allow = ["pkg"] in selm.toml.
Publishing
selm publish uploads a source-only Hex release plus docs. Like elm publish, it diffs your exposed API against the latest Hex release and requires a matching MAJOR.MINOR.PATCH bump: PATCH when nothing exposed changed, MINOR for additions only, MAJOR for removals or signature changes.
selm bump writes that version into selm.toml. A package that is not on Hex yet can publish any version. Use --replace only when Hex still allows replacing the same version.