| name | setting-up-tauri-projects |
| description | Helps users create and initialize new Tauri v2 projects for building cross-platform desktop and mobile applications. Covers system prerequisites and setup requirements for macOS, Windows, and Linux. Guides through project creation using create-tauri-app or manual Tauri CLI initialization. Explains project directory structure and configuration files. Supports vanilla JavaScript, TypeScript, React, Vue, Svelte, Angular, SolidJS, and Rust-based frontends. Use when the user wants to start a new Tauri project, set up Tauri v2, or asks about Tauri project initialization and prerequisites. |
Setting Up Tauri Projects
What is Tauri?
Tauri is a framework for building tiny, fast cross-platform desktop and mobile applications. It pairs any HTML/JS/CSS frontend with a Rust backend, using the system webview instead of bundling a browser.
System Prerequisites
macOS
xcode-select --install
Windows
- Microsoft C++ Build Tools: Download from Visual Studio, select "Desktop development with C++"
- WebView2: Pre-installed on Windows 10 v1803+ (install manually if needed)
- Rust toolchain:
winget install Rustlang.Rustup
rustup default stable-msvc
Linux
Debian/Ubuntu:
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file \
libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
Arch Linux:
sudo pacman -S webkit2gtk-4.1 base-devel curl wget file openssl \
appmenu-gtk-module libappindicator-gtk3 librsvg xdotool
Fedora:
sudo dnf install webkit2gtk4.1-devel openssl-devel curl wget file \
libappindicator-gtk3-devel librsvg2-devel libxdo-devel \
@development-tools
Rust (All Platforms)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
winget install Rustlang.Rustup
Node.js
Required only for JavaScript/TypeScript frontends. Install LTS version from nodejs.org.
Verify Prerequisites
After installing Rust and Node.js, confirm they are available:
rustc --version
node --version
If either command fails or shows an older version, revisit the installation steps above before proceeding.
Mobile Development (Optional)
Android (all platforms):
rustup target add aarch64-linux-android armv7-linux-androideabi \
i686-linux-android x86_64-linux-android
Set environment variables: JAVA_HOME, ANDROID_HOME, NDK_HOME
iOS (macOS only):
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
brew install cocoapods
Creating a Project
Method 1: create-tauri-app (Recommended)
Interactive scaffolding with framework templates.
npm create tauri-app@latest
pnpm create tauri-app
yarn create tauri-app
bun create tauri-app
cargo install create-tauri-app --locked
cargo create-tauri-app
sh <(curl https://create.tauri.app/sh)
irm https://create.tauri.app/ps | iex
Prompts you'll see:
- Project name
- Bundle identifier (e.g.,
com.example.app)
- Frontend language: TypeScript/JavaScript, Rust, or .NET
- Package manager
- UI template: vanilla, Vue, Svelte, React, SolidJS, Angular, Preact, Yew, Leptos, Sycamore
After scaffolding:
cd your-project
npm install
npm run tauri dev
Verify: npm run tauri dev should compile the Rust backend and open a window displaying your frontend. If the window appears, the project is set up correctly.
Gotcha — "svelte" template is SvelteKit, not plain Svelte. create-tauri-app's svelte / svelte-ts templates scaffold a full SvelteKit project (with src/routes/, src/app.html, and @sveltejs/kit as a dep) — not plain Svelte + Vite. SvelteKit adds file-based routing, adapters, and SSR tooling that a single-window desktop widget doesn't need. For plain Svelte, use Method 2 instead: scaffold the frontend with npm create vite@latest . -- --template svelte-ts, then npx tauri init. The vue, react, solid, and preact templates produce plain Vite projects as expected — only the Svelte template differs.
Method 2: Manual Setup (Existing Projects)
Add Tauri to an existing frontend project.
npm install -D @tauri-apps/cli@latest
npx tauri init
tauri init prompts:
- App name
- Window title
- Frontend dev server URL (e.g.,
http://localhost:5173)
- Frontend build output directory (e.g.,
dist)
- Frontend dev command (e.g.,
npm run dev)
- Frontend build command (e.g.,
npm run build)
npx tauri dev
Verify: npx tauri dev should compile the Rust backend and open a window with your existing frontend. If the window appears, Tauri integration is working.
Project Structure
my-tauri-app/
├── package.json # Frontend dependencies
├── index.html # Frontend entry point
├── src/ # Frontend source code
│ └── main.js
└── src-tauri/ # Rust backend
├── Cargo.toml # Rust dependencies
├── Cargo.lock
├── build.rs # Tauri build script
├── tauri.conf.json # Main Tauri configuration
├── capabilities/ # Permission/capability definitions
├── icons/ # App icons (all formats)
└── src/
├── lib.rs # Main Rust code + mobile entry point
└── main.rs # Desktop entry point
Key Files
tauri.conf.json - Primary configuration:
{
"productName": "my-app",
"version": "0.1.0",
"identifier": "com.example.my-app",
"build": {
"devUrl": "http://localhost:5173",
"frontendDist": "../dist"
},
"app": {
"windows": [{ "title": "My App", "width": 800, "height": 600 }]
}
}
src/lib.rs - Rust application code:
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
src/main.rs - Desktop entry point:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
app_lib::run();
}
capabilities/ - Define what commands JavaScript can invoke:
{
"identifier": "main-capability",
"windows": ["main"],
"permissions": ["core:default"]
}
Common Commands
npm run tauri dev
npm run tauri build
npm run tauri icon path/to/icon.png
npm run tauri android init
npm run tauri ios init
npm run tauri android dev
npm run tauri ios dev
Quick Reference: Supported Frontend Templates
| Template | Languages | Notes |
|---|
| vanilla | JS, TS | No framework |
| react | JS, TS | Vite-based |
| vue | JS, TS | Vite-based |
| svelte | JS, TS | Vite-based |
| solid | JS, TS | Vite-based |
| angular | TS | Angular CLI |
| preact | JS, TS | Vite-based |
| yew | Rust | Rust WASM frontend |
| leptos | Rust | Rust WASM frontend |
| sycamore | Rust | Rust WASM frontend |