Slimmer desktop AI apps: a 128MB stack beats Electron bloat

A single “Hello World” in Electron can swallow 200 MB of disk space and hundreds of megabytes of RAM. Python’s AI libraries are fast, but bundling them for non-technical users still feels like navigating distribution hell. One developer’s experiment shows how to escape both traps.
Rewriting the laws of desktop app physics
The new ERTH stack—ElectroBun, Robyn, Turso, HTMX—ships a full desktop AI agent inside a 128 MB binary. Instead of bundling Chromium or forcing Rust on every contributor, the architecture lets Python handle AI orchestration while the front end stays lean. ElectroBun provides the OS-native WebKit shell, Robyn runs Python in a Rust-powered sidecar, Turso stores data both on disk and in the cloud, and HTMX renders HTML fragments without client-side JavaScript. The result is a zero-JS desktop app that launches in milliseconds and stays light even when running a local LLM.
Four layers, one lightweight lifecycle
ElectroBun starts the show by binding directly to the system’s native WebView, avoiding Electron’s overhead. The Bun runtime keeps idle memory low and the main process booting fast. Robyn, a high-performance async Python framework built on Rust, handles heavy logic—local LLM mounting, database orchestration—spawned dynamically on an ephemeral port to dodge conflicts. Turso (libSQL) keeps a local file that syncs to the cloud in the background, giving offline resilience without sacrificing speed. Finally, HTMX turns the backend into a hypermedia server that swaps HTML fragments into the DOM, eliminating build pipelines and client-side state headaches.
Debugging the cross-language beast
Mixing Bun, Python, and Rust in one app introduces a few traps. To keep the Python sidecar alive, a watchdog self-heals the process if it crashes. Port collisions are avoided by spawning Robyn on port zero. The team also added a silent health check that restarts the sidecar before the UI notices anything. Together, these measures keep the stack reliable without adding weight.
Source: DEV Community. AI-assisted editorial synthesis — TechnoExpress.

