Minimal template for building cross-platform desktop applications with Tauri and SvelteKit.
-
Set up your development environment for Tauri: https://tauri.studio/en/docs/getting-started/intro
-
Install Tauri CLI
cargo install tauri-cli --version ^1.0.0-beta
-
Set up your project
cd your-project npm install
cargo tauri dev
cargo tauri build --verbose
Here is a step-by-step guide on how to set up a project like this from scratch.
-
Firstly, complete the first two steps in Setting up
-
Initialize a new SvelteKit app
npm init svelte@next my-app # Which Svelte app template? » Skeleton project # Use TypeScript? » Yes # Add ESLint for code linting? » Yes # Add Prettier for code formatting? » Yes cd my-app npm install
-
Install additional dependencies
npm install @tauri-apps/api @sveltejs/adapter-static@next
-
Configure svelte.config.js
// Add this to the imports import adapter from '@sveltejs/adapter-static'; // Add this under config.kit adapter: adapter({ pages: 'build', assets: 'build' }),
-
Initialize a Tauri project
cargo tauri init # Where are your web assets located? » ../build # What is the url of your dev server? » http://localhost:3000
-
Configure
src-tauri/tauri.conf.json
- Set
beforeDevCommand
tonpm run dev
- Set
beforeBuildCommand
tonpm run build
- Set
-
Test it out
cargo tauri info cargo tauri dev