Manual Setup Using the Tauri CLI

Set up a Tauri v2 project from scratch by initializing your frontend first, installing the Tauri CLI manually, and using tauri init to generate the Rust backend.

The create-tauri-app scaffolding tool is the quickest way to start a Tauri project, but it is not the only way. If you already have a frontend project—or you prefer to bring your own tooling and stay in full control of the setup—you can add Tauri to it step by step. This guide walks through that manual process.

When you finish, you will have a working Tauri v2 project with a src-tauri directory that holds the Rust backend, a configured development workflow, and a window on your screen that shows your web content inside a native shell.

Prerequisites:

This page assumes your machine already has the base dependencies required by Tauri: Node.js (if you use a JavaScript frontend), Rust (via rustup), and platform-specific system libraries. If you have not installed those yet, go through the System Dependencies Overview chapter first and come back.

What You Will Build

By the end of this guide you will have:

  • A frontend project of your choice (plain HTML, React, Vue, Svelte, etc.) running on a local dev server.
  • The @tauri-apps/cli installed as a development dependency (or the tauri-cli Rust crate installed globally).
  • A src-tauri directory generated by tauri init that contains the Tauri configuration and Rust entry point.
  • A verified tauri dev run that opens a native window rendering your frontend.

Everything is done in a handful of explicit steps. You are not forced into any particular frontend framework or package manager.

1

Step 1: Create and Initialize a Frontend Project

Start in an empty directory. You can set up your frontend however you want—the only requirement is that you can serve the built files as static assets and that a development server runs during development.

A common choice is Vite because it is lightweight and works with many frameworks. The example below creates a vanilla JavaScript Vite project, but you can replace the template with react-ts, vue, svelte, or any other supported option.

Choose the tab that matches your package manager:

mkdir my-tauri-app
cd my-tauri-app
npm create vite@latest . -- --template vanilla
npm install

If you are using a different framework (Next.js, Nuxt, Leptos, Yew, plain static files), set up your project as you normally would. The only thing Tauri cares about is the dev server URL and the output directory for production builds.

Frontend independent:

Tauri does not dictate your frontend stack. As long as you have an index.html entry point and a way to serve your app during development, the rest of the steps work the same.

2

Step 2: Install the Tauri CLI

The Tauri CLI (tauri) is the tool that initialises the Rust side, starts the development loop, and builds the final application bundle. You can install it in two ways: as a local development dependency of your Node.js project, or globally via Cargo.

Local installation (recommended for JavaScript/TypeScript projects) pins the CLI version in your package.json, so everyone on the team uses the same version.

npm install -D @tauri-apps/cli@latest

After installation you can verify the CLI is available. If you installed it locally, prefix commands with npx (or use yarn tauri, pnpm tauri, bun tauri):

npx tauri --version

Global vs local Cargo install:

Installing tauri-cli via Cargo makes the cargo tauri command globally available, but it does not read your local package.json. If your project is a Node.js workspace, prefer the local npm install so the CLI lives alongside your other frontend tooling.

3

Step 3: Determine Your Frontend Dev Server URL

During development Tauri opens a native window and points it at your frontend dev server. You need to tell Tauri exactly which URL to load. The default depends on the tool:

Framework / ToolDefault dev server URL
Vitehttp://localhost:5173
Create React Apphttp://localhost:3000
Next.js (pages router)http://localhost:3000
Nuxthttp://localhost:3000
SvelteKithttp://localhost:5173
Angularhttp://localhost:4200
Plain serve / http-serveroften http://localhost:5000

If you changed the port in your frontend config, use the URL you configured. You can check by starting your dev server now and looking at the terminal output:

npm run dev

Write down the full URL including the port. You will need it in the next step.

4

Step 4: Run `tauri init`

The tauri init command scans your project and asks a few questions to generate the src-tauri directory. Run it from the root of your project (the folder that contains your package.json or frontend config):

npx tauri init

You will see a series of interactive prompts. Here is what each one means and how to answer it for a typical Vite project:

  • App name – The human-readable name of your application. This shows up in window titles, about dialogs, and bundle metadata. Use something like my-tauri-app.
  • Window title – The default title shown in the title bar. Usually the same as the app name.
  • Web assets location – The directory that contains your production build output, relative to the src-tauri/tauri.conf.json file that will be created. For a Vite project the build output goes to dist by default, so you would enter ../dist. If your build tool outputs to build, out, or target, adjust accordingly.
  • Dev server URL – The URL from Step 3. For Vite this is normally http://localhost:5173.
  • Frontend dev command – The command Tauri runs to start your dev server when you execute tauri dev. For a Vite project this is typically npm run dev, yarn dev, pnpm dev, or bun dev.
  • Frontend build command – The command Tauri runs to create a production build before packaging the app. For Vite it is npm run build (or the equivalent for your package manager).

After you answer, tauri init creates a src-tauri folder with the following files:

src-tauri/
├── Cargo.toml          # Rust package manifest and dependencies
├── tauri.conf.json     # Tauri configuration (window, build, bundle)
├── src/
│   └── lib.rs          # Rust entry point and plugin registration
├── icons/              # Default application icons
└── capabilities/       # Permissions for Tauri APIs

For detailed configuration options of tauri.conf.json, see tauri.conf.json. Permissions are declared inside the capabilities Directory.

The web assets path is critical:

Many first-time setup failures happen because the distDir (derived from the web assets location) points to the wrong folder. If it does not match where your build tool places the final index.html, the packaged app will show a blank screen. Double-check this value. For Vite, ../dist is almost always correct. For Create React App, use ../build. For Next.js static exports, use ../out.

5

Step 5: Configure Your Build Tool to Ignore `src-tauri` (if needed)

Some development servers watch the entire project directory for file changes and restart when a file is modified. The src-tauri folder contains Rust source files, compiled artifacts, and the Tauri configuration. If your frontend dev server watches these files, it can trigger unnecessary rebuilds and consume extra CPU.

Vite is the most common tool where this matters. Add a server.watch.ignored option to your vite.config.ts (or vite.config.js):

vite.config.ts
import { defineConfig } from "vite";
export default defineConfig({
  server: {
    watch: {
      ignored: ["**/src-tauri/**"],
    },
  },
});

If you are using Webpack, you can configure watchOptions.ignored similarly. For Next.js, Nuxt, or SvelteKit the default watcher configuration usually does not traverse outside the source directory, so no extra change is necessary.

Skipping this step causes noisy dev loops:

Without ignoring src-tauri, Vite will restart every time Tauri rebuilds or any Rust artifact changes. This leads to a flickering browser preview and a slower feedback cycle.

6

Step 6: Verify with `tauri dev`

You are now ready to start the full Tauri development environment. This command will:

  1. Start your frontend dev server (if it is not already running).
  2. Compile the Rust backend.
  3. Open a native window showing your frontend.
npx tauri dev

The first run will download and compile Rust crates, which can take a few minutes. Subsequent runs are much faster because the compiled dependencies are cached.

When everything works, a native window appears and displays your frontend. Changes you make to your frontend source files will hot-reload inside the window, just as they would in the browser.

Success indicator:

If you see your web content in a native window with your app name in the title bar, the manual setup is complete. The console output should also show "Running BeforeDevCommand...", "Running DevCommand...", and finally "Webview opened at http://localhost:5173".

Common Pitfalls During Manual Setup

Even with the steps followed carefully, a few mistakes show up repeatedly. Knowing them ahead of time saves debugging frustration.

Using the wrong dev server URL. If the browser devtools open inside the Tauri window and show ERR_CONNECTION_REFUSED, the URL Tauri is trying to reach does not match where your dev server is actually running. Revisit Step 3 and run tauri init again if necessary, or edit the "devUrl" field in src-tauri/tauri.conf.json directly.

Missing Rust toolchain or build tools. If tauri dev fails with a Rust compilation error mentioning a missing linker or cc, your system does not have the required native build tools. On Windows this usually means the "Desktop development with C++" workload is not installed. On Linux the build-essential or base-devel package may be missing. The System Dependencies Overview chapter has the full list.

Incorrect distDir. When you eventually run tauri build to create a distributable package, a blank screen often means the distDir in tauri.conf.json points to a folder that does not contain index.html. Look at the "build" section and verify the path relative to src-tauri/tauri.conf.json. This is the distDir value Tauri uses for production. For a full walkthrough of directory layouts, see Key Files and Directories Explained.

Rust edition and version:

Tauri v2 requires Rust 1.77.2 or later. If tauri dev fails with an error about an unsupported Rust version, update your toolchain with rustup update stable.