atomvm_gleam

Typed Gleam wrappers for AtomVM v0.7.0-beta.0 — peripherals, networking, crypto, AtomGL display, and AtomVM WASM / emscripten browser APIs.

Package version tracks the matching AtomVM pre-release (0.7.0-beta.0). APIs may still shift until AtomVM ships a stable 0.7.0.

Requirements

[dependencies]
atomvm_gleam = ">= 0.7.0-beta.0 and < 0.8.0"

Supported modules

Coverage against AtomVM v0.7.0-beta.0 / release-0.7 libs (avm_esp32, avm_rp2, avm_network, avm_emscripten, eavmlib, estdlib), plus AtomGL and atomvm_websocket_client.

Gleam moduleUpstreamStatus
atomvm_gleam/gpiogpio (ESP32 + RP2)Full public API, including Pico WL pins and set_function
atomvm_gleam/i2ci2cFull public API
atomvm_gleam/spispiFull public API
atomvm_gleam/uartuartFull public API (+ usb_serial_jtag_name)
atomvm_gleam/usb_cdcusb_cdc (ESP32 / RP2 / STM32)Full public API
atomvm_gleam/ledcledcFull public API (timers, channels, fade, duty/freq)
atomvm_gleam/adcesp_adcFull public API (resource + pin convenience paths)
atomvm_gleam/esp_dacesp_dacPublic oneshot API (new_channel, output, delete)
atomvm_gleam/espespFull public API (NVS, sleep, partitions incl. mmap, RTC, mount, WDT, MAC, timer_get_time)
atomvm_gleam/picopicoFull public API (CYW43 GPIO + RTC)
atomvm_gleam/networknetworkFull public API (STA/AP, wait helpers, scan, RSSI/status, SNTP/mDNS config)
atomvm_gleam/httpahttp_clientFull public API (connect/request/stream/recv/close)
atomvm_gleam/http_serverhttp_serverFull public API
atomvm_gleam/mdnsmdnsResponder lifecycle + DNS parse/serialize helpers
atomvm_gleam/sslsslClient API (start/stop/connect/send/recv/close)
atomvm_gleam/consoleconsoleFull public API (start, puts/puts_to, print/print_err, flush/flush_handle)
atomvm_gleam/atomvmatomvmPlatform, AVM packs, random, POSIX I/O (incl. termios), subprocess, get_creation
atomvm_gleam/avm_pubsubavm_pubsubFull public API (start/start_named, publish, sub/unsub)
atomvm_gleam/cryptocryptoHash, MAC, AEAD, streaming cipher, PBKDF2, ECDH/EdDH, sign/verify, strong_rand_bytes
atomvm_gleam/jsonjsonencode/decode (+ /2//3), streaming decode, fine-grained encode helpers (default encoder/decoders)
atomvm_gleam/displayAtomGL display portopen / update / font register/deregister
atomvm_gleam/websocketatomvm_websocket_clientESP-IDF port: open / send text|binary / close
atomvm_gleam/emscriptenavm_emscripten emscriptenJS interop + HTML5 callbacks (register_* / register_*_with / register_*_with_user_data)
atomvm_gleam/emscripten_websocketavm_emscripten websocketBrowser WebSocket NIF (full public API)

Import as atomvm_gleam/<module>, e.g. import atomvm_gleam/gpio.

Two WebSocket modules

Gleam modulePlatformUpstream
atomvm_gleam/websocketESP-IDF (and images that include the port driver)atomvm_websocket_client
atomvm_gleam/emscripten_websocketEmscripten / browser onlyAtomVM avm_emscripten Erlang module websocket

They are not interchangeable: different message shapes, APIs, and platforms. Check atomvm.platform() (or emscripten_websocket.is_supported()) before calling the browser NIF on mixed-target builds.

AtomVM WASM / emscripten

AtomVM can run as WebAssembly in the browser or under Node. Gleam code for that target is still compiled for the Erlang BEAM and loaded by AtomVM WASM — use @external(erlang, ...) FFI as elsewhere in this package. Gleam’s JavaScript backend is a different toolchain and is not used here.

Upstream docs (prefer release-0.7):

Browser hosting note (high level): AtomVM’s web build uses SharedArrayBuffer, so pages must be served from localhost or HTTPS with COOP/COEP headers (Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp). See the AtomVM getting-started guide for hosting options; this package does not document a full deploy tutorial.

Known gaps vs AtomVM 0.7

Public AtomVM-facing modules targeted by this package are wrapped. Remaining intentional omissions:

AreaNotes
atomvmDeprecated rand_bytes/1 omitted — use crypto.strong_rand_bytes
jsonCustom OTP encoder funs / custom decoder callback maps — not expressible cleanly in Gleam; default encoder/decoders are provided

Intentionally out of scope for this package:

Development

gleam format
gleam build

Agent / contribution conventions: AGENTS.md.

✨ Search Document