Skip to main content

Tauri-0 - Setting up a Tauri project

· 2 min read

I have been planning to work on a toy project that combines my interest in frontend and backend development. Since Tauri is a way to create desktop applications using web technologies and Rust, I decided to explore it. This post starts a series of entries documenting my journey with Tauri, which I intend to commit to over the next year.

Tauri - Introduction

Tauri, in its own words, is:

a framework for building tiny, fast binaries for all major desktop and mobile platforms. Developers can integrate any frontend framework that compiles to HTML, JavaScript, and CSS for building their user experience while leveraging languages such as Rust, Swift, and Kotlin for backend logic when needed.

My chosen stack for using Tauri is:

  • Frontend: React
  • Backend: Rust

This is where I will begin. I also plan to try Svelte as a frontend framework in the future.

Develop

First, create a new project:

yarn create <project-name>

Scaffold the project by selecting the options you prefer. I chose:

  • React
  • Yarn
  • Typescript

Next, install the dependencies:

cd <project-name>
yarn install

To run the project:

yarn tauri dev

To use the project with VSCode and ensure compatibility with the Rust analyzer extension, add the following to .vscode/settings.json:

{
"rust-analyzer.linkedProjects": [
// Add the path to the Tauri project's Rust directory containing the Cargo.toml
"<project-name>/src-tauri/Cargo.toml"
],
}

The configuration above ensures that the Rust analyzer can locate the dependencies in the Tauri project and display the correct types and documentation when you hover over the Rust code.

That's it.

References