<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rehan Mazhar</title>
    <description>The latest articles on DEV Community by Rehan Mazhar (@rehan_mazhar_542c0a8b2074).</description>
    <link>https://dev.to/rehan_mazhar_542c0a8b2074</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3825979%2Fefc3b91e-ea62-4cef-a62c-a6585a3fec28.webp</url>
      <title>DEV Community: Rehan Mazhar</title>
      <link>https://dev.to/rehan_mazhar_542c0a8b2074</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rehan_mazhar_542c0a8b2074"/>
    <language>en</language>
    <item>
      <title>R1: A Runtime That Runs Tauri Apps in the Browser</title>
      <dc:creator>Rehan Mazhar</dc:creator>
      <pubDate>Sun, 15 Mar 2026 22:31:22 +0000</pubDate>
      <link>https://dev.to/rehan_mazhar_542c0a8b2074/r1-a-runtime-that-runs-tauri-apps-in-the-browser-1h64</link>
      <guid>https://dev.to/rehan_mazhar_542c0a8b2074/r1-a-runtime-that-runs-tauri-apps-in-the-browser-1h64</guid>
      <description>&lt;p&gt;&lt;strong&gt;Live demo&lt;/strong&gt;: &lt;a href="https://r1-todo-demo.netlify.app/" rel="noopener noreferrer"&gt;https://r1-todo-demo.netlify.app/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Source code&lt;/strong&gt;: &lt;a href="https://github.com/12errh/r1-tauriweb-runtime-v1" rel="noopener noreferrer"&gt;https://github.com/12errh/r1-tauriweb-runtime-v1&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Tauri is a fantastic framework for building desktop apps with a Rust backend and a web frontend. But sharing a Tauri app with someone still means sending them an installer, asking them to trust an executable, and waiting for them to download 50–100MB. For a lot of use cases — demos, quick tools, apps for non-technical users — that friction kills adoption.&lt;/p&gt;

&lt;p&gt;What if you could just send someone a URL?&lt;/p&gt;

&lt;h2&gt;
  
  
  What R1 Does
&lt;/h2&gt;

&lt;p&gt;R1 is a browser-native runtime for Tauri. You take your existing Tauri project, add one line to your &lt;code&gt;vite.config.ts&lt;/code&gt;, run &lt;code&gt;npm run build&lt;/code&gt;, and the output is a static folder. Deploy it to Vercel, Netlify, or GitHub Pages. Anyone with a browser can now run your app instantly.&lt;/p&gt;

&lt;p&gt;No server. No backend. No installer. Just a URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The browser is a sandbox — you can't run a native Rust binary inside it. R1 solves this with a layered architecture:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Rust → WASM&lt;/strong&gt;&lt;br&gt;
The R1 Vite plugin automatically compiles your &lt;code&gt;src-tauri/&lt;/code&gt; directory to WebAssembly using &lt;code&gt;wasm-pack&lt;/code&gt; during &lt;code&gt;npm run build&lt;/code&gt;. The &lt;code&gt;.wasm&lt;/code&gt; binary is bundled as a static asset.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Kernel Worker&lt;/strong&gt;&lt;br&gt;
All WASM execution happens in a dedicated Web Worker — never the main thread. If your Rust code blocks for 2 seconds processing a file, the UI stays perfectly responsive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. WASI Shim&lt;/strong&gt;&lt;br&gt;
When Rust is compiled to &lt;code&gt;wasm32-wasi&lt;/code&gt;, every &lt;code&gt;std::fs&lt;/code&gt; call becomes a WASI syscall. R1 intercepts those syscalls and redirects them to the browser's Origin Private File System (OPFS). Your Rust code calls &lt;code&gt;std::fs::write("/data/todos.json", ...)&lt;/code&gt; exactly as it would on a desktop — it just happens to write to OPFS instead of a real disk. Files persist across page refreshes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. IPC Bridge&lt;/strong&gt;&lt;br&gt;
Real Tauri injects &lt;code&gt;window.__TAURI_INTERNALS__&lt;/code&gt; into your app's WebView. R1 patches the same global at boot time. Your frontend calls &lt;code&gt;invoke('add_todo', { text: 'Buy milk' })&lt;/code&gt; exactly as it always did. R1 routes that call through the Kernel Worker to your WASM backend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Event Bridge&lt;/strong&gt;&lt;br&gt;
Rust can emit events back to JS using &lt;code&gt;r1::emit("progress", payload)&lt;/code&gt;. These arrive at your &lt;code&gt;listen()&lt;/code&gt; handlers in the frontend — the same API you use in a real Tauri app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Service Worker&lt;/strong&gt;&lt;br&gt;
Asset URLs (&lt;code&gt;convertFileSrc('/app/logo.png')&lt;/code&gt;) are intercepted by a Service Worker that reads the file from OPFS and serves it with the correct MIME type.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Status
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;code&gt;invoke()&lt;/code&gt; — Tauri v1 and v2 compatible&lt;/li&gt;
&lt;li&gt;✅ &lt;code&gt;std::fs&lt;/code&gt; read/write from Rust (via WASI → OPFS)&lt;/li&gt;
&lt;li&gt;✅ Rust → JS event bridge&lt;/li&gt;
&lt;li&gt;✅ Serde JSON bridge for complex data&lt;/li&gt;
&lt;li&gt;✅ WASM panic isolation&lt;/li&gt;
&lt;li&gt;✅ Tauri API plugins: &lt;code&gt;fs&lt;/code&gt;, &lt;code&gt;event&lt;/code&gt;, &lt;code&gt;store&lt;/code&gt;, &lt;code&gt;os&lt;/code&gt;, &lt;code&gt;path&lt;/code&gt;, &lt;code&gt;dialog&lt;/code&gt;, &lt;code&gt;clipboard&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;✅ Virtual Window Manager (macOS, Windows 11, Linux themes)&lt;/li&gt;
&lt;li&gt;✅ 31/31 unit tests passing&lt;/li&gt;
&lt;li&gt;✅ Live todo demo running on Netlify&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Limitations (Being Honest)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The WASI shim covers the most common syscalls but not all of them&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;shell&lt;/code&gt; execute is stubbed — you can't spawn real child processes in a browser&lt;/li&gt;
&lt;li&gt;Heavy native dependencies that can't compile to WASM won't work&lt;/li&gt;
&lt;li&gt;Best suited for simple to medium complexity Tauri apps right now&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;The live demo is a real Tauri todo app — written as a standard desktop Tauri project, then compiled through R1. Add a todo, close the tab, reopen it. The data persists.&lt;/p&gt;

&lt;p&gt;If you have a simple Tauri app, I'd love for you to try running it through R1 and see what breaks. That feedback is exactly what drives the next version.&lt;/p&gt;

&lt;p&gt;The full architecture roadmap that guided the build is in the repository if you want to understand the design decisions.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>showdev</category>
      <category>tooling</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
