Tauri 2 in practice: one app on six devices

Building an app for Android, iPhone, Mac, Windows, Linux and the web from one project with Tauri 2 — what to share, what not, and the pitfalls.

Tomáš Renčík5 min read
Illustration for the article: Tauri 2 in practice: one app on six devices
Contents
  1. 1. What Tauri is
  2. 2. What you can actually share
  3. 3. What can't be shared (and there's no point forcing it)
  4. 4. Pitfalls I ran into
  5. 5. How to get started
  6. 6. Practice exercise
  7. 7. Frequently asked questions
  8. 8. Is it worth it?
  9. 9. Related articles

In short: Tauri 2 combines a web interface (for example Vue) with a native core in Rust and builds an application for both desktop and mobile from a single project. You share the interface and most of the logic; platform-specific things such as signing, app stores or system permissions are handled separately for each platform.

Just a few years ago I was building “only” websites. Today I have my own applications that run on computers and on phones — and I build them on my own. A large part of that change was made possible by Tauri 2.

In this article I'll explain how Tauri works, what saved me the most time in practice and where I tripped up.

What Tauri is

Tauri is a framework for applications in which:

  • you write the interface like a website (HTML, CSS, JavaScript — Vue, React, Svelte, anything),
  • the application's “brain” runs in Rust,
  • the result is a native application for the given system.

Tauri 2 added mobile (Android and iOS) to desktop (Windows, macOS, Linux). On iOS, the iPhone and iPad are both served by a single app. Hence “six devices”.

Unlike Electron, Tauri doesn't ship a whole browser. It uses the web renderer the system already has (WebView2 on Windows, WebKit on Mac and iOS, WebView on Android). That's why apps are smaller and start faster.

What you can actually share

The interface – almost all of it. One set of components, one design. Differences are handled by CSS (media queries, safe areas on the iPhone) and a few conditions in the code.

The logic in Rust – a large part of it. Working with files, networking, encryption, the database — you write these once. Rust is compiled separately for each system.

Communication between them. The interface calls functions in Rust through so-called commands:

#[tauri::command]
fn pozdrav(meno: &str) -> String {
    format!("Ahoj, {meno}!")
}
import { invoke } from '@tauri-apps/api/core'
const text = await invoke('pozdrav', { meno: 'Janko' })

That's the whole magic. The interface knows nothing about the system, Rust knows nothing about buttons.

What can't be shared (and there's no point forcing it)

  • System features – notifications, photo access, launching at startup, a tray icon. Tauri has plugins for these, but every system behaves differently. Expect some things to work only on desktop and others only on mobile.
  • Signing and distribution – every store has its own rules. Apple wants certificates and profiles, Google a signing key, Windows ideally a signed installer. This is work no framework will do for you.
  • Differences between web renderers – WebKit on iOS sometimes behaves differently from Chromium on Android. Test on real devices, not just in the browser.

Pitfalls I ran into

1. “It works on my machine.” Building for iOS and Android involves more steps, and each can fail somewhere else: Xcode, the Android SDK, tool paths. It pays to have one script that runs the whole build, and to write down exactly what you configured. In six months you won't remember.

2. Files and paths. The documents folder is somewhere different on every system. Never hard-code paths — use the API that tells you where they are.

3. Screens and safe areas. The iPhone has a notch and a bottom bar. Without env(safe-area-inset-bottom), your buttons will end up underneath the system's own controls.

4. Updates. You can update desktop apps yourself (Tauri has an updater). Mobile goes through the stores — a different rhythm, a different review.

5. Don't write native code until you have to. You can solve most things with the web and Rust. I only needed Swift or Kotlin for things that couldn't be done any other way — and then it's good to know that Tauri allows it.

How to get started

  1. Desktop first. Get the app running on your own system until it does what you want.
  2. Then Android — the tools are available on every system.
  3. Finally iOS — you need a Mac and an Apple developer account.
  4. Make the interface responsive from day one. Retrofitting mobile into a desktop design hurts.

The official documentation is at v2.tauri.app and it's genuinely good — start there, not with a random tutorial from 2022.

Practice exercise

Try building a small “Notes” app over one weekend:

  1. Interface: a list of notes and a field for adding a new one.
  2. Rust: one command that saves the notes to a file in the app's folder, and another that loads them.
  3. Run it on your computer, then in the Android emulator.
  4. Find out exactly where on disk the file was saved on each system — and why it's in a different place.

This small exercise will hit everything that matters: communication between the web and Rust, file paths, permissions and the differences between systems.

Frequently asked questions

Do I need to know Rust before I start?

No. To begin with, simple functions that take and return a value are enough. You'll learn Rust gradually as you need more.

Is it better than Flutter or React Native?

It's different. If you're at home on the web and want to share the desktop too, Tauri is the natural choice. If you're only doing mobile and want a fully native look, other tools may make more sense.

How much does publishing in the stores cost?

Apple and Google both have their own developer account fees. Check the current amounts directly with them — they change.

Is it worth it?

If you're a web developer and want to build applications, Tauri is in my view the shortest path. You don't relearn the interface from scratch, you only learn the system around it. Rust is demanding at first, but the compiler will train you — and what compiles usually works too.

I didn't go from web developer to developer for six devices in a week. But without Tauri it would have taken years.

  • #Tauri
  • #Rust
  • #cross-platform
  • #mobil
  • #desktop