Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

One Vue app, three homes: desktop with Tauri, Android with Capacitor, and the web

I wanted a Reddit client that lived on my desktop and my phone — without maintaining two separate apps. So I built one Vue app and gave it three homes: Tauri (Rust) wraps it as a desktop app for Windows/macOS/Linux, Capacitor wraps it for Android, and it still runs as a plain web app. One UI, one set of Reddit API calls, one OAuth flow — three targets. It works. But "just wrap your web app" hides…

The author wanted a single Reddit client that could run on multiple platforms without needing to maintain separate apps for each. They built one Vue app and gave it three different install locations: Tauri for desktop on Windows, macOS, and Linux; Capacitor for Android; and a plain web app for anyone who just wants a URL.

However, the process of wrapping the web app in these different platforms revealed a few challenges. First, Tauri relies on each platform's native toolchain for building different installer types - .msi for Windows, .dmg for macOS, and .deb or .AppImage for Linux. This means that a CI pipeline with a separate runner for each OS is necessary to build the app for all platforms.

Second, Tauri doesn't include a browser engine, so it uses the system WebView. This can be an issue on older Windows systems (Windows 7-10) where WebView2 might not be installed. To avoid a blank white screen upon opening the app, the author recommends bundling the WebView2 bootstrapper in the installer to ensure it self-installs.

Third, OAuth redirects are more complex in a packaged app without a web server at the callback URL. The solution is to register a custom scheme or deep link, allowing the OS to handle the redirect and extract the OAuth code from the incoming URL. This process is often overlooked in tutorials, making it a significant stumbling block for developers.

Finally, a default release binary from Rust can be quite large. By tweaking Cargo.toml flags such as disabling unwinding, reducing code generation units, enabling link-time optimization, and setting the optimization level to "s", the binary size can be reduced significantly. This optimization comes with no code changes, making it a worthwhile effort for a cross-platform application.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 18 August →