<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fh="http://purl.org/syndication/history/1.0"><channel><title>Flux | Blog</title><description>Flux — a write-once UI language for native iOS and Android. Write .flux, hot-reload on device over binary patches, and ship SwiftUI + Jetpack Compose.</description><link>https://flux-rs-docs.vercel.app/</link><language>en</language><fh:complete/><atom:link rel="self" href="https://flux-rs-docs.vercel.app/blog/rss.xml"/><item><title>How we built a mobile UI compiler with two execution tiers</title><link>https://flux-rs-docs.vercel.app/blog/welcome-to-flux/</link><guid isPermaLink="true">https://flux-rs-docs.vercel.app/blog/welcome-to-flux/</guid><pubDate>Sun, 15 Nov 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Mobile UI toolkits usually force a bad trade-off. You either ship a JavaScript runtime to get fast reload loops, or you compile directly to native widgets and wait on Xcode and Gradle every time you adjust padding.&lt;/p&gt;
&lt;p&gt;We built Flux to separate iteration speed from production output using one Reactive Tree IR.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-goal&quot;&gt;The Goal&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;We wanted a single UI language (&lt;code dir=&quot;auto&quot;&gt;.flux&lt;/code&gt;) that emits idiomatic SwiftUI and Jetpack Compose for release builds while still updating a running phone screen over WebSocket during development. Editing a layout had to preserve local state like cursor position and scroll offset without rebuilding the native host app.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-architecture&quot;&gt;The Architecture&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The compiler is a 16-crate Rust workspace (~63,000 lines of code) paired with native host kits in Swift and Kotlin. Every frontend file lowers into &lt;code dir=&quot;auto&quot;&gt;flux-ir&lt;/code&gt;, which splits into two execution paths.&lt;/p&gt;
&lt;div data-astro-cid-udrfwtvx=&quot;&quot;&gt;&lt;article data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;svg data-astro-cid-mhvouzvf=&quot;true&quot; aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot; data-astro-cid-ib7v6bda=&quot;&quot;&gt;&lt;path d=&quot;M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span data-astro-cid-mhvouzvf=&quot;&quot;&gt;Dev Tier (Register VM)&lt;/span&gt;&lt;/p&gt;&lt;div data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;flux-differ&lt;/code&gt; computes structural diffs and sends binary MessagePack patches over WebSocket. A compact VM updates a native shadow tree on device.&lt;/p&gt;&lt;/div&gt;&lt;/article&gt;&lt;article data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;svg data-astro-cid-mhvouzvf=&quot;true&quot; aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot; data-astro-cid-ib7v6bda=&quot;&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M1.44 8.855v-.001l3.527-3.516c.34-.344.802-.541 1.285-.548h6.649l.947-.947c3.07-3.07 6.207-3.072 7.62-2.868a1.821 1.821 0 0 1 1.557 1.557c.204 1.413.203 4.55-2.868 7.62l-.946.946v6.649a1.845 1.845 0 0 1-.549 1.286l-3.516 3.528a1.844 1.844 0 0 1-3.11-.944l-.858-4.275-4.52-4.52-2.31-.463-1.964-.394A1.847 1.847 0 0 1 .98 10.693a1.843 1.843 0 0 1 .46-1.838Zm5.379 2.017-3.873-.776L6.32 6.733h4.638l-4.14 4.14Zm8.403-5.655c2.459-2.46 4.856-2.463 5.89-2.33.134 1.035.13 3.432-2.329 5.891l-6.71 6.71-3.561-3.56 6.71-6.711Zm-1.318 15.837-.776-3.873 4.14-4.14v4.639l-3.364 3.374Z&quot; clip-rule=&quot;evenodd&quot;&gt;&lt;/path&gt;&lt;path d=&quot;M9.318 18.345a.972.972 0 0 0-1.86-.561c-.482 1.435-1.687 2.204-2.934 2.619a8.22 8.22 0 0 1-1.23.302c.062-.365.157-.79.303-1.229.415-1.247 1.184-2.452 2.62-2.935a.971.971 0 1 0-.62-1.842c-.12.04-.236.084-.35.13-2.02.828-3.012 2.588-3.493 4.033a10.383 10.383 0 0 0-.51 2.845l-.001.016v.063c0 .536.434.972.97.972H2.24a7.21 7.21 0 0 0 .878-.065c.527-.063 1.248-.19 2.02-.447 1.445-.48 3.205-1.472 4.033-3.494a5.828 5.828 0 0 0 .147-.407Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span data-astro-cid-mhvouzvf=&quot;&quot;&gt;Release Tier (Native Codegen)&lt;/span&gt;&lt;/p&gt;&lt;div data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;flux-codegen-swift&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;flux-codegen-kotlin&lt;/code&gt; generate &lt;code dir=&quot;auto&quot;&gt;@State&lt;/code&gt; views and &lt;code dir=&quot;auto&quot;&gt;@Composable&lt;/code&gt; functions with no interpreter bundled.&lt;/p&gt;&lt;/div&gt;&lt;/article&gt;&lt;article data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;svg data-astro-cid-mhvouzvf=&quot;true&quot; aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot; data-astro-cid-ib7v6bda=&quot;&quot;&gt;&lt;path d=&quot;M17 22H5a3 3 0 0 1-3-3V9a3 3 0 0 1 3-3h1a4 4 0 0 1 7.3-2.18c.448.64.692 1.4.7 2.18h3a1 1 0 0 1 1 1v3a4 4 0 0 1 2.18 7.3A3.86 3.86 0 0 1 18 18v3a1 1 0 0 1-1 1ZM5 8a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h11v-3.18a1 1 0 0 1 1.33-.95 1.77 1.77 0 0 0 1.74-.23 2 2 0 0 0 .93-1.37 2 2 0 0 0-.48-1.59 1.89 1.89 0 0 0-2.17-.55 1 1 0 0 1-1.33-.95V8h-3.2a1 1 0 0 1-1-1.33 1.77 1.77 0 0 0-.23-1.74 1.939 1.939 0 0 0-3-.43A2 2 0 0 0 8 6c.002.23.046.456.13.67A1 1 0 0 1 7.18 8H5Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span data-astro-cid-mhvouzvf=&quot;&quot;&gt;Structural Node Identity&lt;/span&gt;&lt;/p&gt;&lt;div data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p&gt;Node IDs are FNV-1a-32 hashes of tree position and keys rather than sequential counters, keeping state intact across patches.&lt;/p&gt;&lt;/div&gt;&lt;/article&gt;&lt;article data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;svg data-astro-cid-mhvouzvf=&quot;true&quot; aria-hidden=&quot;true&quot; width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot; fill=&quot;currentColor&quot; data-astro-cid-ib7v6bda=&quot;&quot;&gt;&lt;path d=&quot;M18.71 7.21a1 1 0 0 0-1.42 0l-7.45 7.46-3.13-3.14A1.02 1.02 0 1 0 5.29 13l3.84 3.84a1.001 1.001 0 0 0 1.42 0l8.16-8.16a1 1 0 0 0 0-1.47Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span data-astro-cid-mhvouzvf=&quot;&quot;&gt;ISA Parity Gate&lt;/span&gt;&lt;/p&gt;&lt;div data-astro-cid-mhvouzvf=&quot;&quot;&gt;&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;flux-parity&lt;/code&gt; executes traces against 92 golden ISA vectors in CI to verify that the dev VM and release emitters match.&lt;/p&gt;&lt;/div&gt;&lt;/article&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;what-it-cost&quot;&gt;What it cost&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Supporting two execution tiers over one IR means every new UI primitive has to be implemented twice: once in the host shadow tree runtime and once in both native code generators.&lt;/p&gt;
&lt;p&gt;We also had to keep the wire protocol strict. Prop indices are derived from FNV-1a-32 hashes of prop names rather than hardcoded offsets. If a host kit and the dev server fall out of sync on hashing, views render blank—which is why the wire protocol, VM ISA, and adapter contracts carry explicit version checks.&lt;/p&gt;
&lt;aside aria-label=&quot;Limitations&quot;&gt;&lt;p aria-hidden=&quot;true&quot;&gt;Limitations&lt;/p&gt;&lt;div&gt;&lt;p&gt;Flux targets apps where UI logic is shared across iOS and Android. If your screen relies heavily on platform-specific Apple or Google APIs (such as ARKit or custom Metal shaders), writing native Swift or Kotlin directly is still simpler than wrapping every binding through host extensions.&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;div&gt;&lt;h2 id=&quot;getting-started&quot;&gt;Getting started&lt;/h2&gt;&lt;/div&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;cargo&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;build&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;--release&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-p&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;flux-cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;flux&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;dev&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The source and parity suite are in the repository, and the &lt;a href=&quot;https://flux-rs-docs.vercel.app/explanation/architecture/&quot;&gt;architecture guide&lt;/a&gt; maps out the 16 crates.&lt;/p&gt;</content:encoded></item></channel></rss>