setting-up-tauri-projects by dchuk/claude-code-tauri-skills
npx skills add https://github.com/dchuk/claude-code-tauri-skills --skill setting-up-tauri-projectsTauri 是一个用于为所有主流桌面和移动平台构建小巧、快速二进制文件的框架。它将任何可编译为 HTML/JS/CSS 的前端与 Rust 后端相结合。
主要特点:
# 用于桌面 + iOS 开发
# 从 Mac App Store 安装 Xcode
# 仅用于桌面开发(更轻量选项)
xcode-select --install
winget install Rustlang.Rustup
rustup default stable-msvc
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
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
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
# macOS/Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Windows (PowerShell)
winget install Rustlang.Rustup
仅 JavaScript/TypeScript 前端需要。从 nodejs.org 安装 LTS 版本。
Android(所有平台):
# 安装 Android Studio,然后添加 Rust 目标平台
rustup target add aarch64-linux-android armv7-linux-androideabi \
i686-linux-android x86_64-linux-android
设置环境变量:JAVA_HOME、ANDROID_HOME、NDK_HOME
iOS(仅限 macOS):
# 需要完整版 Xcode(不仅仅是命令行工具)
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
# 安装 Cocoapods
brew install cocoapods
使用框架模板进行交互式脚手架搭建。
# npm
npm create tauri-app@latest
# pnpm
pnpm create tauri-app
# yarn
yarn create tauri-app
# bun
bun create tauri-app
# cargo(无需 Node.js)
cargo install create-tauri-app --locked
cargo create-tauri-app
# Shell 脚本
sh <(curl https://create.tauri.app/sh) # Bash
irm https://create.tauri.app/ps | iex # PowerShell
您将看到的提示:
com.example.app)脚手架搭建完成后:
cd your-project
npm install
npm run tauri dev
将 Tauri 添加到现有的前端项目中。
# 1. 在您现有的项目中,安装 Tauri CLI
npm install -D @tauri-apps/cli@latest
# 2. 初始化 Tauri(创建 src-tauri 目录)
npx tauri init
tauri init 提示:
应用名称
窗口标题
前端开发服务器 URL(例如 http://localhost:5173)
前端构建输出目录(例如 dist)
前端开发命令(例如 npm run dev)
前端构建命令(例如 npm run build)
npx tauri dev
my-tauri-app/
├── package.json # 前端依赖项
├── index.html # 前端入口点
├── src/ # 前端源代码
│ └── main.js
└── src-tauri/ # Rust 后端
├── Cargo.toml # Rust 依赖项
├── Cargo.lock
├── build.rs # Tauri 构建脚本
├── tauri.conf.json # 主要的 Tauri 配置
├── capabilities/ # 权限/能力定义
├── icons/ # 应用图标(所有格式)
└── src/
├── lib.rs # 主要的 Rust 代码 + 移动端入口点
└── main.rs # 桌面端入口点
tauri.conf.json - 主要配置:
{
"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 应用代码:
#[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 - 桌面端入口点:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
app_lib::run();
}
capabilities/ - 定义 JavaScript 可以调用哪些命令:
{
"identifier": "main-capability",
"windows": ["main"],
"permissions": ["core:default"]
}
# 带热重载的开发
npm run tauri dev
# 构建生产环境二进制文件
npm run tauri build
# 从源图像生成应用图标
npm run tauri icon path/to/icon.png
# 添加 Android 目标平台
npm run tauri android init
# 添加 iOS 目标平台
npm run tauri ios init
# 在 Android 上运行
npm run tauri android dev
# 在 iOS 模拟器上运行
npm run tauri ios dev
| 模板 | 语言 | 备注 |
|---|---|---|
| vanilla | JS, TS | 无框架 |
| react | JS, TS | 基于 Vite |
| vue | JS, TS | 基于 Vite |
| svelte | JS, TS | 基于 Vite |
| solid | JS, TS | 基于 Vite |
| angular | TS | Angular CLI |
| preact | JS, TS | 基于 Vite |
| yew | Rust | Rust WASM 前端 |
| leptos | Rust | Rust WASM 前端 |
| sycamore | Rust | Rust WASM 前端 |
每周安装量
53
仓库
GitHub Stars
10
首次出现
2026年1月24日
安全审计
安装于
opencode45
gemini-cli44
codex44
claude-code41
cursor39
github-copilot36
Tauri is a framework for building tiny, fast binaries for all major desktop and mobile platforms. It combines any frontend that compiles to HTML/JS/CSS with Rust for the backend.
Key characteristics:
# For desktop + iOS development
# Install Xcode from Mac App Store
# For desktop-only development (lighter option)
xcode-select --install
winget install Rustlang.Rustup
rustup default stable-msvc
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
# macOS/Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Windows (PowerShell)
winget install Rustlang.Rustup
Required only for JavaScript/TypeScript frontends. Install LTS version from nodejs.org.
Android (all platforms):
# Install Android Studio, then add Rust targets
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):
# Requires full Xcode (not just Command Line Tools)
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
# Install Cocoapods
brew install cocoapods
Interactive scaffolding with framework templates.
# npm
npm create tauri-app@latest
# pnpm
pnpm create tauri-app
# yarn
yarn create tauri-app
# bun
bun create tauri-app
# cargo (no Node.js required)
cargo install create-tauri-app --locked
cargo create-tauri-app
# Shell scripts
sh <(curl https://create.tauri.app/sh) # Bash
irm https://create.tauri.app/ps | iex # PowerShell
Prompts you'll see:
com.example.app)After scaffolding:
cd your-project
npm install
npm run tauri dev
Add Tauri to an existing frontend project.
# 1. In your existing project, install Tauri CLI
npm install -D @tauri-apps/cli@latest
# 2. Initialize Tauri (creates src-tauri directory)
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
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
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"]
}
# Development with hot reload
npm run tauri dev
# Build production binary
npm run tauri build
# Generate app icons from source image
npm run tauri icon path/to/icon.png
# Add Android target
npm run tauri android init
# Add iOS target
npm run tauri ios init
# Run on Android
npm run tauri android dev
# Run on iOS simulator
npm run tauri ios dev
| 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 |
Weekly Installs
53
Repository
GitHub Stars
10
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode45
gemini-cli44
codex44
claude-code41
cursor39
github-copilot36
Rust性能优化指南:m10-performance技能详解,包含算法、数据结构与内存优化策略
718 周安装