tauri
Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
Top Related Projects
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Make any web page a desktop application
Portable and lightweight cross-platform desktop application development framework
Create beautiful applications using Go
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
A library for building cross-platform native desktop applications with Node.js and CSS 🚀. React NodeGui : https://react.nodegui.org and Vue NodeGui: https://vue.nodegui.org
Quick Overview
Tauri is an open-source framework for building lightweight, secure, and cross-platform desktop applications using web technologies. It allows developers to create native applications with HTML, CSS, and JavaScript while leveraging Rust for the backend, resulting in smaller, faster, and more secure applications compared to traditional Electron-based apps.
Pros
- Smaller application size and better performance due to Rust backend
- Enhanced security features, including custom protocol schemes and CSP
- Cross-platform support for Windows, macOS, and Linux
- Seamless integration with various web frameworks (React, Vue, Svelte, etc.)
Cons
- Steeper learning curve for developers unfamiliar with Rust
- Smaller ecosystem and community compared to Electron
- Limited access to some native APIs compared to fully native development
- Potential compatibility issues with certain web APIs and libraries
Code Examples
- Creating a new Tauri application:
npm init tauri-app my-tauri-app
cd my-tauri-app
npm run tauri dev
- Invoking a Rust function from JavaScript:
// In JavaScript
import { invoke } from '@tauri-apps/api/tauri'
async function greet(name) {
return await invoke('greet', { name })
}
console.log(await greet('World'))
// In Rust (src-tauri/src/main.rs)
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
- Using Tauri's file system API:
import { readTextFile, writeTextFile } from '@tauri-apps/api/fs'
async function readAndWriteFile() {
const contents = await readTextFile('path/to/file.txt')
await writeTextFile('path/to/newfile.txt', contents.toUpperCase())
}
Getting Started
- Install Rust and Node.js
- Install Tauri CLI:
npm install -g @tauri-apps/cli
- Create a new Tauri project:
npm init tauri-app my-app
- Navigate to the project directory:
cd my-app
- Start the development server:
npm run tauri dev
For more detailed instructions and configuration options, refer to the official Tauri documentation at https://tauri.app/v1/guides/getting-started/setup.
Competitor Comparisons
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Pros of Electron
- Larger ecosystem and community support
- More mature and battle-tested in production environments
- Extensive documentation and learning resources
Cons of Electron
- Larger application size due to bundled Chromium
- Higher memory usage and slower startup times
- Less efficient resource utilization compared to native apps
Code Comparison
Electron (JavaScript):
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
Tauri (Rust):
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Tauri offers a more lightweight and efficient alternative to Electron, using native system webviews instead of bundling Chromium. It provides smaller application sizes, faster startup times, and better performance. However, Electron has a larger ecosystem, more extensive documentation, and a longer track record in production environments. The code comparison shows the different approaches: Electron uses JavaScript for the main process, while Tauri uses Rust for the backend logic.
Make any web page a desktop application
Pros of Nativefier
- Simpler setup and usage, requiring minimal configuration
- Supports a wider range of platforms, including older operating systems
- Faster development process for basic web-to-desktop conversions
Cons of Nativefier
- Limited customization options compared to Tauri
- Larger app sizes due to bundling Electron
- Less performant and resource-efficient than Tauri-based applications
Code Comparison
Nativefier (JavaScript):
nativefier 'https://example.com' --name 'My App'
Tauri (Rust):
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Nativefier focuses on simplicity, allowing quick conversion of web apps to desktop with a single command. Tauri offers more control and better performance but requires more setup and coding. Nativefier is ideal for rapid prototyping, while Tauri is better suited for production-ready, high-performance desktop applications.
Portable and lightweight cross-platform desktop application development framework
Pros of Neutralinojs
- Lighter weight and smaller bundle size
- Simpler architecture with fewer dependencies
- Easier to get started for developers new to desktop app development
Cons of Neutralinojs
- Less mature ecosystem and community support
- Fewer built-in security features
- Limited native API access compared to Tauri
Code Comparison
Neutralinojs:
Neutralino.os.showMessageBox('Welcome', 'Hello Neutralino!');
Tauri:
tauri::Builder::default()
.setup(|app| {
tauri::WindowBuilder::new(app, "main", tauri::WindowUrl::default())
.title("Welcome")
.build()?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
Both frameworks allow developers to create desktop applications using web technologies. Neutralinojs focuses on simplicity and lightweight builds, making it easier for beginners to get started. Tauri, on the other hand, offers a more robust set of features, better security, and deeper integration with native APIs, but comes with a steeper learning curve and more complex architecture.
Create beautiful applications using Go
Pros of Wails
- Simpler setup and development process, especially for Go developers
- Better performance for CPU-intensive tasks due to Go's efficiency
- Easier integration with existing Go libraries and ecosystems
Cons of Wails
- Smaller community and ecosystem compared to Tauri
- Less extensive documentation and fewer learning resources
- Limited cross-platform support (primarily Windows, macOS, and Linux)
Code Comparison
Wails (Go):
package main
import "github.com/wailsapp/wails/v2/pkg/runtime"
func (a *App) Greet(name string) string {
return fmt.Sprintf("Hello %s!", name)
}
Tauri (Rust):
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
Both frameworks allow easy integration of backend logic with frontend UI. Wails uses Go for backend logic, while Tauri uses Rust. The syntax and structure are similar, but Tauri's approach is more declarative with the use of attributes.
Wails is generally easier for Go developers to pick up, while Tauri offers more robust security features and a larger ecosystem. Both frameworks aim to simplify desktop application development using web technologies, but they cater to different language preferences and development philosophies.
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
Pros of Revery
- Built with OCaml, offering strong type safety and functional programming benefits
- Focuses on cross-platform native UI development with a single codebase
- Leverages React-like concepts for familiar component-based architecture
Cons of Revery
- Smaller community and ecosystem compared to Tauri
- Less mature and fewer production-ready applications
- Steeper learning curve for developers not familiar with OCaml
Code Comparison
Revery (OCaml):
let%component make () =
let%hook (count, setCount) = React.useState(0) in
<View>
<Text text={string_of_int count} />
<Button title="Increment" onPress={() => setCount(count + 1)} />
</View>
Tauri (Rust + JavaScript):
#[tauri::command]
fn increment(count: i32) -> i32 {
count + 1
}
import { invoke } from '@tauri-apps/api/tauri'
const count = await invoke('increment', { count: 0 })
Revery focuses on a unified OCaml codebase for both UI and logic, while Tauri separates backend (Rust) and frontend (web technologies) concerns. Revery's approach may lead to more consistent code, but Tauri offers greater flexibility in technology choices and leverages existing web development skills.
A library for building cross-platform native desktop applications with Node.js and CSS 🚀. React NodeGui : https://react.nodegui.org and Vue NodeGui: https://vue.nodegui.org
Pros of NodeGUI
- Uses native Qt widgets, resulting in a more native look and feel
- Generally lighter on system resources compared to Electron-based solutions
- Supports cross-platform development for desktop and mobile
Cons of NodeGUI
- Smaller community and ecosystem compared to Tauri
- Less extensive documentation and fewer learning resources
- Limited to Node.js and React for development
Code Comparison
NodeGUI example:
const { QMainWindow, QWidget, QLabel, FlexLayout } = require("@nodegui/nodegui");
const win = new QMainWindow();
const centralWidget = new QWidget();
centralWidget.setObjectName("myroot");
const rootLayout = new FlexLayout();
centralWidget.setLayout(rootLayout);
const label = new QLabel();
label.setText("Hello World");
rootLayout.addWidget(label);
Tauri example:
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Both frameworks offer unique approaches to desktop application development, with NodeGUI focusing on native Qt widgets and Tauri leveraging web technologies with a Rust backend. The choice between them depends on specific project requirements and developer preferences.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Introduction
Tauri is a framework for building tiny, blazingly fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.
The user interface in Tauri apps currently leverages tao
as a window handling library on macOS, Windows, Linux, Android and iOS. To render your application, Tauri uses WRY, a library which provides a unified interface to the system webview, leveraging WKWebView on macOS & iOS, WebView2 on Windows, WebKitGTK on Linux and Android System WebView on Android.
To learn more about the details of how all of these pieces fit together, please consult this ARCHITECTURE.md document.
Getting Started
If you are interested in making a tauri app, please visit the documentation website.
The quickest way to get started is to install the prerequisites for your system and create a new project with create-tauri-app
. For example with npm
:
npm create tauri-app@latest
Features
The list of Tauri's features includes, but is not limited to:
- Built-in app bundler to create app bundles in formats like
.app
,.dmg
,.deb
,.rpm
,.AppImage
and Windows installers like.exe
(via NSIS) and.msi
(via WiX). - Built-in self updater (desktop only)
- System tray icons
- Native notifications
- Localhost free (ð¥)
- GitHub action for streamlined CI
- VS Code extension
Platforms
Tauri currently supports development and distribution on the following platforms:
Platform | Versions |
---|---|
Windows | 7 and above |
macOS | 10.15 and above |
Linux | webkit2gtk 4.0 for Tauri v1 (for example Ubuntu 18.04). webkit2gtk 4.1 for Tauri v2 (for example Ubuntu 22.04). |
iOS/iPadOS (beta) | 9 and above |
Android (beta) | 7 and above |
Contributing
Before you start working on something, it's best to check if there is an existing issue first. It's also a good idea to stop by the Discord server and confirm with the team if it makes sense or if someone else is already working on it.
Please make sure to read the Contributing Guide before making a pull request.
Thank you to everyone contributing to Tauri!
Documentation
Documentation in a polyglot system is a tricky proposition. To this end, we prefer to use inline documentation in the Rust & JS source code as much as possible. Check out the hosting repository for the documentation site for further information: https://github.com/tauri-apps/tauri-docs
Partners
For the complete list of sponsors please visit our website and Open Collective.
Organization
Tauri aims to be a sustainable collective based on principles that guide sustainable free and open software communities. To this end it has become a Programme within the Commons Conservancy, and you can contribute financially via Open Collective.
Licenses
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable.
Logo: CC-BY-NC-ND
- Original Tauri Logo Designs by Alve Larsson, Daniel Thompson-Yvetot and Guillaume Chau
Top Related Projects
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Make any web page a desktop application
Portable and lightweight cross-platform desktop application development framework
Create beautiful applications using Go
:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
A library for building cross-platform native desktop applications with Node.js and CSS 🚀. React NodeGui : https://react.nodegui.org and Vue NodeGui: https://vue.nodegui.org
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot