# Making a HyperBEAM device

## How to make a device (Forge)

Devices live in their own repos as ordinary Erlang projects. HyperBEAM ships "Forge", a rebar3 plugin, and a project template.

1. From a HyperBEAM checkout on the `edge` branch: `./install-template --branch edge`
2. Scaffold: `rebar3 new device name=my_device` (gives `src/dev_my_device.erl`, `rebar.config` pinned to HyperBEAM `edge`, README).
3. The root module `dev_<name>.erl` exports the device's keys. Helpers are `dev_<name>_*.erl`. Include `-include_lib("hb/include/hb.hrl").` for macros.
4. Iterate: `rebar3 device package` then `rebar3 device verify`. Test against a fresh preloaded store: `HB_PORT=0 rebar3 device test`. Run a local node with it loaded: `rebar3 device local`.
5. Publish to Arweave: `rebar3 device publish --key wallet.json`. Prints a spec id, an implementation id, and the signer. Operators install it by name or id via `trusted-devices` / `trusted-device-signers` in their node config.

Conventions: one job per device; keys are resolved by HTTP path (`/~mydevice@1.0/key`); messages are maps with commitments; write `%%% @doc` at the top of the root module, it becomes the published specification. Docs: https://github.com/permaweb/HyperBEAM/blob/edge/docs/build/external-device-repository.md and docs/build/device-packaging.md.

Before building anything, check devices.md and the "In the works" list: do not build what exists or is already in review.
