Midgard Packer

Turn a compiled Mix, Rebar3, or Erlang-target Gleam worker into a .midgard package. Packer collects the worker's exact-name BEAM modules and compiled dependencies, then records the entrypoint, protocol, ownership, compiler metadata, and checksums in a manifest.

Midgard is a tech demo. Elixir workers require OTP 29 and the latest Elixir (main) at the runtime's pinned revision; see the toolchain instructions.

Build and inspect

For a Mix worker, set the entrypoint in mix.exs:

packer: [entry: MyWorker]

Then run:

mix packer.pack
mix packer.inspect my_worker.midgard

For a Rebar3 project, use the Rebar3 plugin (rebar3 midgard pack / inspect) or call Packer directly:

mix packer.pack --project path/to/worker --entry my_worker \
  --function handle --protocol midgard.bytes.v1

For Gleam, first build the Erlang target, then use mix packer.pack --project path/to/worker --gleam --entry my_worker --function handle --protocol midgard.bytes.v1.

Install the v0.4.0 archive from Hex:

mix archive.install hex midgard_packer --force

Tree shaking

When packing an Elixir worker's runtime closure (mix midgard.build / deploy), Packer ships only the functions reachable from the entrypoint: a generated worker goes from about 19 MB to 1.5 MB. Add modules or functions your worker calls dynamically with packer: [keep: [...]], or pass --no-shake to ship everything. See the Packer guide.

What inspection means

Packer validates package structure without loading worker modules. Its compatibility report is a static diagnostic, not proof that a particular worker will execute successfully on a host. Packer does not run workers or provide the deployment command; use the Midgard CLI or a language-specific plugin for that.

Packer requires Elixir 1.19+ and OTP 27+ with OTP's :json module. See the artifact guide and examples for full project configuration.