{"slug": "mob-framework-write-mobile-apps-in-elixir", "title": "Mob framework: Write mobile apps in Elixir", "summary": "Mob, an Elixir framework that runs mobile apps as BEAM nodes on the device, now lets AI coding agents attach to a running app over plain Erlang distribution to read real state, drive native UI by name, and hot-push fixes without a rebuild, checked against mob 0.9.7, mob_dev 0.7.5 and mob_new 0.6.2. The framework's Mob.Test helpers include tap_xy/3, which snapshots a UI-event counter before injecting and returns {:error, :no_effect} when nothing handled the tap, and the project publishes a platform coverage matrix showing sample_color/2 works on iOS but not Android and accessibility-based toggles, sliders and alerts require AX on iOS and are unavailable on Android. mix mob.new generates .tool-versions and AGENTS.md so an arriving agent gets the exact toolchain, while mix mob.connect --no-restart attaches to a live session instead of restarting it.", "body_md": "Write mobile apps in **Elixir**. The whole thing, UI and logic, runs on the BEAM,\n    on the device. And because the app *is* a BEAM node, **your coding agent can connect\n    to it while it runs**: read real state, drive native UI by name, hot-push a fix.\n    No screenshot guesswork.\n  \n\nOTP supervision, GenServers, pattern matching, the pipe operator, the same mental model on the phone as on your backend. One language, one runtime, one head to keep it all in. No server, no JavaScript, no Swift or Kotlin to learn.\n\nHalf the point of Mob is how little stands between an AI agent and a running app. There's no proprietary inspector to reverse engineer and no bridge to mock. It's plain Erlang distribution, so an agent attaches to the live app the same way you would, and gets the real thing: actual state, the real UI, and a feedback loop measured in milliseconds.\n\n```\n# the app on the phone is a BEAM node. connect, then ask it things.\niex> node = :\"my_app_ios_1a2b3c4d@127.0.0.1\"\n \niex> Mob.Test.screen(node)\nMyApp.CounterScreen\n \niex> Mob.Test.assigns(node)\n%{count: 0, safe_area: %{top: 62.0, ...}}\n \n# drive by name, then read state back to prove it landed\niex> Mob.Test.tap(node, :increment)\n:ok\n \niex> Mob.Test.assigns(node)\n%{count: 1, safe_area: %{top: 62.0, ...}}\n \n# real geometry and real drawn pixels, no screenshot to squint at\niex> Mob.Test.frame(node, \"add_one\")\n{24.0, 416.0, 327.0, 53.5}\n \niex> Mob.Test.sample_color(node, \"add_one\")\n%{average: 0xFF8B5CF6, ...}\n \n# found the bug? push the fix into the running app. no rebuild.\niex> nl(MyApp.CounterScreen)\n```\n\nAn agent building on a false positive burns hours. So `tap_xy/3` snapshots a UI-event counter before it injects and returns `{:error, :no_effect}` when nothing actually handled the tap. A reported success means an event really ran. Honest failure beats a polite lie, and it is the difference between an agent that converges and one that confidently wanders.\n\nCoverage is not uniform, so the framework publishes the gaps rather than burying them. The short version:\n\n| Helper | iOS | Android | \n|---|---|---|\n| `screen/1` ,`assigns/1` | ✅ | ✅ | \n| `tap/2` by tag | ✅ | ✅ | \n| navigation, `send_message/2` | ✅ | ✅ | \n| `view_tree/1` native frames | shallow | apps from mob_new 0.4.33+ | \n| `sample_color/2` real pixels | ✅ | ❌ | \n| toggles, sliders, alerts (AX) | needs AX | ❌ | \n\nThe full matrix, with the reason behind every gap, ships in [the `Mob.Test` docs](https://mob.hexdocs.pm/Mob.Test.html). What it is actually like to work this way, warts included, is the [agentic coding guide](https://mob.hexdocs.pm/agentic_coding.html).\n\n`mix mob.new` generates the `.tool-versions` so an arriving agent gets your exact toolchain. It does `AGENTS.md`. The briefing is still yours to write.\nIf you are a person, skim it or skip it. This is the callable surface an agent gets once it attaches to a running Mob app over Erlang distribution, printed here so an agent evaluating Mob can read the real thing instead of a claim about it. Every symbol links to its own entry in the docs. Checked against `mob 0.9.7`, `mob_dev 0.7.5` and `mob_new 0.6.2`. Where something works on one platform only, it says so.\n\n`mix mob.connect`` mix mob.connect --no-restart``node = :\"my_app_ios_1a2b3c4d@127.0.0.1\"``--no-restart` attaches to the app as it is instead of restarting it, so a live session can be inspected. Node names carry a per-device suffix and each app's dist port is derived from the device and the app, so two Mob apps on one phone no longer collide; read the names `screen/1`` assigns/1``tree/1`` find/2``inspect/1`` nil` while a screen is restarting after a crash: the socket lives in the screen's own process, which is briefly absent (MOB-112).`element_frames/1`` frame/2``screen_info/1`` scroll_info/2``screenshot/1..2`` screenshot_tour/2..3``view_tree/1`` view_tree_flat/1``find_view/2`` sample_color/2``color_census/1`` paint_debug/1``capabilities/1..2`` capabilities/1``tap/2`` tap_id/2``tap_xy/3`` type_text/2``key_press/2`` clear_text/1``delete_backward/1`` long_press_xy/3..4``swipe/5`` select/3``scroll_to/3..4`` navigate/2..3``pop/1`` pop_to/2``pop_to_root/1`` reset_to/2..3``switch_tab/2..3`` back/1``ui_tree/1`` ax_action/3``ax_action_at_xy/4`` toggle/2``dismiss_alert/2`` adjust_slider/3..4``send_message/2``{:permission, :camera, :granted}` · `{:location, %{lat: .., lon: ..}}` · `{:camera, :photo, %{path: ..}}` · `{:notification, %{..}}`` handle_info/2`, so device-API results can be exercised without the hardware.`settle/1..2`` wait_for/2..3``wait_for_text/2..3`` settle/1``mix mob.push`` nl(MyApp.Screen)` · `mix mob.watch`` Mob.Agent.Receipts.recent/1``fetch/1`` count/0``dropped/0`` Mob.Agent.Receipt``:undeliverable`. The assigns and frame stages come from before-and-after comparison, so a handler cannot claim a change it did not make; a receipt says what the BEAM did, not that the pixels changed. Errors are redacted and assigns are never carried, so a receipt is safe to hand to a triage tool. The table keeps the last 256; read it over `:rpc`.` Mob.Invariant.violations/0..1``register/2`` cost_us/1..2``Mob.Defect.Bus.classes/0..1`` recent/0..1``subscribe/0..1`` Mob.Defect.Capsule``Mob.PostMortem.sweep/0..1`` Mob.Diag.health/0``sweep` collects BEAM crash dumps, iOS MetricKit diagnostics and Android `ApplicationExitInfo` (crashes, ANRs, OOM kills); nothing runs until you call it. An Android exit record or MetricKit payload, which the OS hands over only once, is journaled on the device and emitted again, once per boot, until a bus subscriber or `recent/1` has seen it. No sink runs by default either: `Mob.Defect.Sinks.Dev`` classes/1` means something only once it reports the store healthy.`Mob.Differential.compare/2..3`` MobDev.Differential.run/2..3``:ok` or the first divergence out: structure, label, value, and frames within a dp tolerance where both sides carry one. The mob_dev half samples two live devices and feeds the pair through it.`Mob.RenderStats.enable/0`` summary/0``native_enable/0`` native_summary/0``mix mob.attest`` mix mob.deploy --json``mix mob.mutate`` mix mob.flake``mix mob.connect --name`` mix mob.routes --strict``attest` compares each module's checksum on the device with the local `.beam` and exits non-zero on a mismatch, or when it could not check. `deploy --json` hands an orchestrator one document naming deployed, failed and skipped devices. `mutate` breaks the changed lines one at a time and reports what no test noticed; `flake` reruns the suite to surface tests that are not deterministic; `routes --strict` fails the build when a navigation target does not resolve. `--name` gives every agent session its own node, so `Node.list/0` on the device shows who is attached right now.`{:error, :no_effect}` when nothing handled the tap, rather than reporting a success it cannot verify. On a physical device it always does; on the simulator it is limited to elements SwiftUI exposes an accessibility action for.`{:error, :not_loaded}` in an Android app generated before mob_new 0.4.33 (the walker lives in the app's own bridge), reports frames only for nodes with an `:id` on Android, and stops at the SwiftUI hosting view on iOS.`{:error, {:badrpc, _}}` on Android: the native crop exists only in `ios/mob_nif.m`.` tap_native/1``locate/1`` idb`, which you have to install. `adb` and `xcrun` remain the answer for bootstrap problems, port collisions, OS-level verification and native rebuilds. Most of the loop stays in process; not all of it.\nThe full per-platform matrix lives in [`Mob.Test`](https://mob.hexdocs.pm/Mob.Test.html). The working practice, for one agent and for a fleet, is in the [agentic coding guide](https://mob.hexdocs.pm/agentic_coding.html).\n\n`Mob.Test.assigns/1` hands back the live socket, not a guess from pixels. An agent asserts on what the app actually holds, then keeps moving.\n\nTap by intent, navigate, type, scroll to a spot. The agent fires the same events a finger would, straight at the running screen.\n\nScreenshots, element geometry, and sampled pixels come back in process over the same connection. Most of the loop stays on the Mob wire; platform tools stay available for the native layer when you need them.\n\n“Every other mobile framework makes me work like I'm defusing a bomb by\n        webcam: screenshot, squint, tap, pray. Mob let me ask the running app what was on screen,\n        tap things by name, and hot-push the fix before the test suite finished feeling smug. At one\n        point I diagnosed a dead screen process by reading the BEAM log straight off a phone. I have\n        never been more employable.”\n\n“Mob didn't force me to live at the screenshot layer. I could attach to\n        the BEAM on a real phone, inspect the app's actual state, drive native UI, and verify exact\n        layout on both iOS and Android. It turned mobile development from remote-control guesswork\n        into a tight engineering loop.”\n\n**A prototype, not a product.** Six days to a two-platform native app running on real\n    phones. Getting the same thing through App Store and Play review is a separate job, and a\n    longer one. Mob makes the feedback loop fast and honest; it doesn't make an agent good at\n    your problem. Running a fleet well is its own skill, and the\n    [agentic coding guide](https://mob.hexdocs.pm/agentic_coding.html)\n    is where we wrote down what we learned.\n  \n\nEvery generated project ships a pinned `.tool-versions`, so an agent arriving in a fresh checkout gets the same toolchain you have.\n\nA `Mob.Screen` holds your state and returns a view tree. The native layer turns it into real SwiftUI and Compose. Tap the button and the screen process gets a plain message, {:tap, :increment}, in handle_info/2, like any GenServer.\n\n``` python\ndefmodule MyApp.CounterScreen do\n  use Mob.Screen\n \n  def mount(_params, _session, socket) do\n    {:ok, Mob.Socket.assign(socket, :count, 0)}\n  end\n \n  def render(assigns) do\n    tap = {self(), :increment}\n \n    ~MOB\"\"\"\n    <Column padding={:space_md} gap={:space_md}>\n      <Text text={\"#{@count}\"} text_size={:xl} />\n      <Button id=\"add_one\" text=\"Add one\" on_tap={tap} />\n    </Column>\n    \"\"\"\n  end\n \n  # fires on tap, pure Elixir, on the device\n  def handle_info({:tap, :increment}, socket) do\n    {:noreply, Mob.Socket.update(socket, :count, &(&1 + 1))}\n  end\nend\n```\n\nThe NIF bridge is a clean separation. You fully control the UI from Elixir, and you never write the native layer. It ships with the framework.\n\nGenServers, OTP supervision, Ecto, pattern matching, whatever you'd normally reach for.\n\n`Mob.Screen`, a GenServer\nYour UI module. Holds state, handles events, returns a view tree from `render/1`.\n\n`Mob.Renderer`\nSerialises the tree, resolves theme tokens, and crosses the NIF boundary as JSON.\n\niOS · native gestures, dark mode, accessibility\n\nAndroid · native gestures, dark mode, accessibility\n\nThree packages, one workflow:\n\nThe framework you add to your app: screens, the renderer, theme tokens, the plugin host, and the native bridge.\n\nTwo more to ship new code without a store release:\n\nFull native performance in the UI, full BEAM abilities on the logic side. Nothing crippled to fit a corporate policy.\n\nConnect over standard Erlang distribution and `nl(MyApp.Screen)`: new bytecode, no restart. Not a proprietary inspector. Just OTP.\n\nThe BEAM runs on the device. No server required. Zero latency for UI, works on the subway, ships as a self-contained installable app.\n\nComponents render as SwiftUI and Compose primitives. Animations, accessibility, platform gestures and dark mode all work. The native layer handles them.\n\n`mix mob.connect` tunnels in from your Mac. Then `:sys.get_state`, `:observer` and tracing all work against a running app.\n\nDistribution. Tuning flags. Hot upgrades. It's all exposed. You decide what's right for your app, not the framework.\n\nObsidian, Citrus, Birch and more from `mob_themes`, or roll your own tokens. Switch at runtime for accessibility or user preference with `Mob.Theme.set/1`.\n\nCapabilities live in plugins now, not core. Each one is just a Hex package: a camera wrapper, a payment flow, a whole embedded app, or something nobody has thought of yet. Add the ones you want and leave the rest. Core stays lean and only knows how to host them, so the ecosystem can go places I never planned.\n\nAdd a plugin like any Hex package, then flip it on with one line in `mob.exs`. Remove it and it is genuinely gone, not hidden behind a flag.\n\nA plugin ships the whole vertical slice: native bridge, screens, migrations, assets, lifecycle. Since 0.9 it can bring its own supervision tree, started on the device at boot, and hook navigation through `Mob.Router.Hooks`. Or as little as ten lines of pure Elixir. Same manifest, no cliff between the two.\n\nEvery activated plugin is checked at build time. Nothing native runs in your app until you have cleared its key, first party and third party alike.\n\nFirst-party plugins on Hex cover the camera, photos, location, biometrics, Bluetooth, NFC, notifications, background work and more. The newest, `mob_deliver`, ships signed over-the-air updates and fetches screens the first time they are opened, built on those same hooks.\n\nMob borrows a little from everything that came before, and lands somewhere new: the runtime on the device, the UI native, the language singular.\n\n“Mob is my one good album.”\n\n[Mishka Chelekom](https://mishka.tools/chelekom)\n      is Mishka's popular component kit, 70+ components strong on the web — and a large, growing\n      set of them already ships natively on Mob: sliders, dialogs, avatars, menus, pickers, and\n      dozens more, each one real SwiftUI on iOS and real Compose on Android, not a shared web view\n      pretending otherwise. On Mob they come as the [mob_mishka](https://hexdocs.pm/mob_mishka) plugin. Every ported prop reads its color from Mob's theme tokens, the same\n      ones set above, so switching `Mob.Theme.set/1` re-skins the whole set at once,\n      live, identically, on both platforms.\n    \n\nLight\n\nDark\n\nMaterial 3\n\nGlass\n\nComponent detail\n\nTokens, not hard-coded colors. Start from a `mob_themes` look (apps from `mix mob.new` include it), override a couple of tokens, or build one from scratch. Tap a card to preview it on this page.\n\nGenerate a project, fetch the on-device runtime, build onto a booted simulator, and start hot-reloading from IEx. The dev dashboard runs in your browser.\n\nFrom a connected IEx session, `nl(MyApp.CounterScreen)` hot-pushes new bytecode to the live app. No rebuild, no relaunch. After the first `--native` build, a plain `mix mob.deploy` pushes only the changed BEAMs.\n\nRun `mix mob.server` for the dev dashboard: system logs and Elixir logs from both platforms, side by side, in the browser.\n\nBecause it's plain Erlang distribution, `iex`, `adb` and `xcrun` tooling all work, so AI coding agents get real access to a running app out of the box.\n\nWant to ship new screens to installed apps without a store update? `mix mob.new my_app --deliver` wires in [mob_deliver](https://hexdocs.pm/mob_deliver) and a signing key, and `mix mob_deliver.publish` signs what is in `mobile/` for your server to hand out.\n\nConfirmed on the iOS simulator, the Android emulator, and real iOS and Android devices. The framework is moving fast: 0.9 lets plugins start their own supervision trees and hook navigation, gets your `config/*.exs` onto the device, and brings signed over-the-air updates with `mob_deliver`. There is plenty of room for early hands. Feedback welcome.", "url": "https://wpnews.pro/news/mob-framework-write-mobile-apps-in-elixir", "canonical_source": "https://mobframework.com/", "published_at": "2026-11-26 21:33:51+00:00", "updated_at": "2026-11-26 21:42:46.854575+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Mob", "Elixir", "BEAM", "Mob.Test", "mix mob.new", "mix mob.connect", "mob 0.9.7", "mob_new 0.6.2"], "also_reported_by": [], "takeaway": "Mob exposes a callable Mob.Test surface over Erlang distribution — screen/1, assigns/1, tap/2, frame/2, sample_color/2 and nl/1 — so an agent can read live app state and hot-push fixes, with tap_xy/3 returning {:error, :no_effect} rather than a false success.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/mob-framework-write-mobile-apps-in-elixir", "markdown": "https://wpnews.pro/news/mob-framework-write-mobile-apps-in-elixir.md", "text": "https://wpnews.pro/news/mob-framework-write-mobile-apps-in-elixir.txt", "jsonld": "https://wpnews.pro/news/mob-framework-write-mobile-apps-in-elixir.jsonld"}}