Tauri
Tauri is a framework to build desktop applications with any frontend framework and a Rust core.
Learn more on the Tauri website.
Adapter
Make sure you use the Static Adapter.
Then you can build your app with
pnpm run buildnpm run buildyarn run buildbun run buildAdd Tauri
To install Tauri:
pnpm install @tauri-apps/clinpm install @tauri-apps/cliyarn add @tauri-apps/clibun install @tauri-apps/cliIn your package.json, add this script:
package.json
"scripts": {
"tauri": "tauri"
}
Then, to scaffold a minimal Rust project that is pre-configured to use Tauri, open a terminal and run the following command:
pnpm run tauri initnpm run tauri inityarn run tauri initbun run tauri initThis command will walk you through a quick setup:
- What is your app name? This will be the name of your final bundle and what the OS will call your app. You can use any name you want here.
- What should the window title be? This will be the title of the default main window. You can use any title you want here.
- Where are your web assets (HTML/CSS/JS) located relative to the
<current dir>/src-tauri/tauri.conf.jsonfile that will be created? This is the path that Tauri will load your frontend assets from when building for production. Use../distfor this value. - What is the URL of your dev server?
This can be either a URL or a file path that Tauri will load during development.
Use
http://localhost:5173for this value. - What is your frontend dev command?
This is the command used to start your frontend dev server.
Use
devcommand (make sure to adapt this to use the package manager of your choice). - What is your frontend build command?
This is the command to build your frontend files.
Use
buildcommand (make sure to adapt this to use the package manager of your choice).
That's it! Finally you can run this command to start developing your app:
pnpm run tauri devnpm run tauri devyarn run tauri devbun run tauri dev