Today, I will show you how you can use Tauri with Nuxt. You can find the files for reference on GitHub. Do not create the project in a synced folder like OneDrive. Replace "tutorial" with your own app name. You may need to have the Visual Studio Build Tools 2019 installed (try installing it if you get a Tauri error).
Create Nuxt Project
To get started, create a blank Nuxt project by following these steps:
- Open a terminal
- Navigate to the parent folder where you want to create the project:
cd "c:/path/to/parent/folder"
- Run this command to initialize a new Nuxt project:
pnpm dlx nuxi@latest init tutorial
Select pnpm as the package manager - Change the current directory to the project folder:
cd tutorial
Initialize Tauri
Next, you need to initialize Tauri in your project by following these steps:
- Install the tauri CLI globaly
pnpm i -g @tauri-apps/cli
- Run this command to install Tauri:
pnpm tauri init
- Answer the prompts as follows:
- What is your app name? ›
tutorial
- What should the window title be? ›
Tutorial
- Where are your web assets (HTML/CSS/JS) located, relative to the "/src-tauri/tauri.conf.json" file that will be created? ›
../.output/public
- What is the url of your dev server? ›
http://localhost:3000
- What is your frontend dev command? ›
pnpm nuxt
- What is your frontend build command? ›
pnpm generate
- What is your app name? ›
- Run this command to install the Tauri API:
pnpm add @tauri-apps/api @tauri-apps/cli
- Optionally, you can also install Sass to use SCSS:
pnpm add sass
Configure some settings
Now, you need to change some settings in your project by following these steps:
- Open your project in Visual Studio Code or its fork Cursor:
code -r .
orcursor -r .
- In package.json, add
"nuxt": "nuxt dev"
to"scripts"
- In package.json, change
"dev": "nuxt dev"
to"dev": "tauri dev"
- In src-tauri/tauri.conf.json change
"identifier"
in"bundle"
in"tauri"
to your own identifier like".tutorial"
or"com.yourwebsite"
- Finally, run
pnpm tauri dev
(this will take some time)
Now it should look similar to this:
To actually build your app, run pnpm tauri build
and open the .exe in src-tauri\target\release
or install the app with the .msi in src-tauri\target\release\bundle\msi
.
If you have any questions/problems/ideas, feel free to add me on discord: waradu
.
My next Nuxt/Tauri tutorials I will make (No order, comment what you would like next):
- Nuxt/Tauri Basics
- Nuxt/Tauri Advanced
- SCSS Basics
- Custom Titlebar with window controls
- Acrylic Window effect
- Implement Fluent Design Theme
Top comments (0)