Something went wrong. Try again.
A social internet radio platform built on AT Protocol. atradio.fm
atproto radio
Something went wrong. Try again.
README.md
atradio (Clojure SDK) #
The official Clojure SDK for atradio.fm. It binds the
shared Rust core (atradio-sdk) through the crate's plain C ABI using the
JVM Panama FFM API (java.lang.foreign) — no JNI, no C glue. The auth /
record / reconcile logic is identical to the Rust, Go, TypeScript, Python, and
Ruby SDKs.
Requirements #
JDK 22+ (FFM is finalized there). This directory pins JDK 25 + Clojure via
mise (mise.toml), independent of the repo root's JDK 21:
cd sdk/clojure
mise trust # once — approve the pinned toolchain
./build.sh # cargo build + copy the native lib onto the classpath
mise exec -- clojure -M:smoke
Usage #
Coordinate (Clojars): fm.atradio/sdk — the reverse-domain group (atradio.fm).
Build the jar with clojure -T:build jar.
(require '[fm.atradio.core :as at])
;; Reads — unauthenticated.
(map #(get-in % ["station" "name"]) (at/recent-stations 10))
(at/popular-stations 10)
(at/favorites "alice.bsky.social" 50)
;; The favorite record key matches every other atradio SDK.
(at/favorite-rkey "rb:...") ; => 16-char hex
;; Writes — app-password login (persists a session file). Stations are maps with
;; camelCase string keys.
(let [agent (at/login "session.json" "alice.bsky.social" "app-password")]
(at/favorite agent {"stationId" "rb:..." "name" "KEXP"
"streamUrl" "https://…" "source" "radio-browser"})
(at/set-play-status agent station)
(at/agent-close agent))
Apps embedding the SDK should pass --enable-native-access=ALL-UNNAMED (see the
:run alias in deps.edn) to silence the FFM restricted-method warnings.
How it works #
crates/atradio-uniffiexposes a plain C ABI (capi.rs) — the same one the Ruby SDK uses.src/atradio/core.cljbinds those functions withjava.lang.foreign(Linker/SymbolLookup/downcallMethodHandles) and marshals JSON.build.shcompiles the crate and drops the native library intonative/(on the classpath).