new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Develop · all subjects

configuration files

80 notes in this subject, read out of this brain and free to use. This is page 1 of 2.

Platform-specific Tauri configuration files

Tauri reads platform-specific configuration from: tauri.linux.conf.json or Tauri.linux.toml for Linux; tauri.windows.conf.json or Tauri.windows.toml for Windows; tauri.macos.conf.json or Tauri.macos.toml for macOS; tauri.android.conf.json or Tauri.android.toml for Android; tauri.ios.conf.json or Tauri.ios.toml for iOS. The platform-specific configuration file is merged with the main configuration object following the JSON Merge Patch (RFC 7396) specification.

Tauri config defines application metadata and runtime behavior

The Tauri configuration (tauri.conf.json or Tauri.toml) is used by the Tauri runtime and CLI to define the source of the Web app, describe application metadata, configure bundles, set plugin configurations, and modify runtime behavior by configuring windows, tray icons, and menus. It can define build settings such as commands to run before tauri build or tauri dev, set the app name and version, control the Tauri runtime, and configure plugins.

package.json scripts for Tauri frontend development

The package.json scripts section stores commands to launch and build the frontend used by the Tauri application. Common scripts include dev (to start the frontend framework) and build (to build the frontend Web assets). These scripts are typically hooked with the Tauri CLI via the tauri.conf.json configuration's beforeDevCommand and beforeBuildCommand hooks. The tauri script is only needed when using npm.

Example tauri.conf.json configuration

Example tauri.conf.json showing configuration structure: ```json5 { build: { devUrl: 'http://localhost:3000', beforeDevCommand: 'npm run dev', }, bundle: { active: true, icon: ['icons/app.png'], }, app: { windows: [ { title: 'MyApp', }, ], }, plugins: { updater: { pubkey: 'updater pub key', endpoints: ['https://my.app.updater/{{target}}/{{current_version}}'], }, }, } ```

Example Tauri.toml configuration

Example Tauri.toml showing configuration structure: ```toml [build] dev-url = "http://localhost:3000" before-dev-command = "npm run dev" [bundle] active = true icon = ["icons/app.png"] [[app.windows]] title = "MyApp" [plugins.updater] pubkey = "updater pub key" endpoints = ["https://my.app.updater/{{target}}/{{current_version}}"] ```

Example platform-specific configuration merge

Example of how platform-specific configuration is merged with base configuration. Given base tauri.conf.json with productName "MyApp", bundle resources ["./resources"], and plugins deep-link {}; and tauri.linux.conf.json with productName "my-app", bundle resources ["./linux-assets"], and plugins cli and deep-link; the resolved Linux configuration has productName "my-app", bundle resources ["./linux-assets"], and both cli and deep-link plugins, demonstrating that platform-specific values override base values and arrays are replaced rather than merged.

Example hooking package.json scripts to Tauri CLI

Example tauri.conf.json hooking package.json scripts to Tauri CLI: ```json { "build": { "beforeDevCommand": "yarn dev", "beforeBuildCommand": "yarn build" } } ``` This configures the beforeDevCommand and beforeBuildCommand hooks to run the dev and build scripts from package.json.

Example building beta app variant with --config

Example of distributing a separate beta application using --config argument. Create tauri.beta.conf.json: ```json { "productName": "My App Beta", "identifier": "com.myorg.myappbeta" } ``` Then build with: npm run tauri build -- --config src-tauri/tauri.beta.conf.json (or equivalent for yarn/pnpm/deno/bun/cargo). This merges the beta configuration with the base configuration to create a separate beta application.

Example package.json for Tauri project

Example package.json for a Tauri project: ```json { "scripts": { "dev": "command to start your app development mode", "build": "command to build your app frontend", "tauri": "tauri" }, "dependencies": { "@tauri-apps/api": "^2.0.0", "@tauri-apps/cli": "^2.0.0" } } ```

tauri.conf.json supported formats

The default Tauri config format is JSON. JSON5 or TOML formats can be enabled by adding the config-json5 or config-toml feature flags to both tauri and tauri-build dependencies in Cargo.toml. The structure and values are the same across all formats, but formatting must be consistent with the respective file format. JSON5 and TOML support comments, and TOML can use kebab-case for config names. Field names are case-sensitive in all three formats.

Extending Tauri configuration via CLI

The Tauri CLI allows extending the configuration when running dev, android dev, ios dev, build, android build, ios build, or bundle commands. Configuration extension is provided by the --config argument either as a raw JSON string or as a path to a JSON file. Tauri uses JSON Merge Patch (RFC 7396) to merge the provided configuration with the originally resolved configuration object. This mechanism is useful for defining multiple application flavours or having more flexibility when configuring application bundles.

Configure dev server with devUrl and beforeDevCommand

To use a development server with a UI framework or JavaScript bundler, configure the devUrl and beforeDevCommand properties in tauri.conf.json. The devUrl should point to your development server (e.g., http://localhost:3000) and beforeDevCommand should specify the command that starts the dev server (e.g., npm run dev).

Configure frontendDist for vanilla JavaScript without bundler

If not using a UI framework or module bundler, point Tauri to your frontend source code using the frontendDist property in tauri.conf.json. The specified folder must include an index.html file along with any other assets loaded by your frontend. The Tauri CLI will start a development server for you.

externalBin configuration in tauri.conf.json

To bundle external binaries as sidecars, add the 'externalBin' property to the 'bundle' object in tauri.conf.json. The property takes an array of strings specifying binaries using absolute or relative paths. Relative paths are resolved relative to the 'tauri.conf.json' file location (src-tauri directory). Example configuration: { "bundle": { "externalBin": [ "/absolute/path/to/sidecar", "../relative/path/to/binary", "binaries/my-sidecar" ] } }

Tauri init configuration prompts

The tauri init command prompts for: app name, window title, web assets location path, dev server URL (e.g., http://localhost:5173), frontend dev command (e.g., pnpm run dev), and frontend build command (e.g., pnpm run build). This creates a src-tauri directory with necessary Tauri configuration files.

Leptos Trunk configuration example

Example Trunk configuration (Trunk.toml) for Leptos project: set build.target to "./index.html", watch.ignore to ["./src-tauri"], serve.port to 1420, serve.open to false, and serve.ws_protocol to "ws".

Leptos Tauri configuration example

Example Tauri configuration (src-tauri/tauri.conf.json) for Leptos project: set build.beforeDevCommand to "trunk serve", build.devUrl to "http://localhost:1420", build.beforeBuildCommand to "trunk build", build.frontendDist to "../dist", and app.withGlobalTauri to true.

Next.js next.config.mjs example for Tauri

const isProd = process.env.NODE_ENV === 'production'; const internalHost = process.env.TAURI_DEV_HOST || 'localhost'; const nextConfig = { output: 'export', images: { unoptimized: true, }, assetPrefix: isProd ? undefined : `http://${internalHost}:3000`, }; export default nextConfig;

Next.js tauri.conf.json build configuration

The build section of tauri.conf.json should be configured with: beforeDevCommand set to the package manager's dev command (npm run dev, yarn dev, pnpm dev, or deno task dev), beforeBuildCommand set to the build command, devUrl set to http://localhost:3000, and frontendDist set to ../out.

Next.js assetPrefix configuration

In next.config.mjs, set assetPrefix to http://${internalHost}:3000 in development mode (when NODE_ENV is not 'production') to ensure the dev server properly resolves assets. The internalHost defaults to 'localhost' but can be overridden with the TAURI_DEV_HOST environment variable.

Next.js frontendDist directory

Configure the frontendDist property in tauri.conf.json to point to the 'out' directory, which is where Next.js outputs static exports.

Nuxt Tauri dev server port requirement

Tauri requires a consistent port. In the Nuxt Vite configuration, set `server: { strictPort: true }` to enforce this requirement.

Nuxt + Tauri SSG requirement

Tauri does not support server-based solutions. Set `ssr: false` in the Nuxt configuration to use static site generation (SSG) mode.

Nuxt default frontendDist path

The default `frontendDist` path for Nuxt projects in `tauri.conf.json` is `../dist`.

Nuxt telemetry configuration

Optionally disable telemetry in `nuxt.config.ts` by setting `telemetry: false`.

Tauri configuration for Nuxt (yarn)

For yarn, set the Tauri build configuration in `tauri.conf.json` with `beforeDevCommand: "yarn dev"`, `beforeBuildCommand: "yarn generate"`, `devUrl: "http://localhost:3000"`, and `frontendDist: "../dist"`.

Tauri configuration for Nuxt (pnpm)

For pnpm, set the Tauri build configuration in `tauri.conf.json` with `beforeDevCommand: "pnpm dev"`, `beforeBuildCommand: "pnpm generate"`, `devUrl: "http://localhost:3000"`, and `frontendDist: "../dist"`.

Tauri configuration for Nuxt (deno)

For deno, set the Tauri build configuration in `tauri.conf.json` with `beforeDevCommand: "deno task dev"`, `beforeBuildCommand: "deno task generate"`, `devUrl: "http://localhost:3000"`, and `frontendDist: "../dist"`.

Nuxt configuration for Tauri

Configure Nuxt for Tauri by setting: `compatibilityDate: '2025-05-15'`, `ssr: false` to enable SSG, `devtools: { enabled: true }` (optional), `devServer: { host: '0' }` for iOS device discovery, and `vite` settings for CLI output (`clearScreen: false`), environment variables (`envPrefix: ['VITE_', 'TAURI_']`), strict port enforcement (`server: { strictPort: true }`), and file watch ignoring (`ignore: ['**/src-tauri/**']` to avoid EMFILE errors).

Nuxt Vite environment variable prefixes

Enable Vite environment variable prefix support in Nuxt by setting `envPrefix: ['VITE_', 'TAURI_']` in the `vite` configuration.

Nuxt src-tauri ignore for file watch

To avoid EMFILE (too many open files) errors during development, add `ignore: ['**/src-tauri/**']` to the Nuxt configuration to exclude the Rust source directory from file watching.

Nuxt devServer host for iOS devices

To enable the development server to be discoverable by other devices when running on iOS physical devices, set `devServer: { host: '0' }` in the Nuxt configuration.

Qwik frontendDist configuration

When setting up a Qwik project with Tauri, configure the frontendDist property in tauri.conf.json to point to the dist/ directory.

Qwik Tauri configuration example

The tauri.conf.json build section for Qwik should include: devUrl set to http://localhost:5173, frontendDist set to ../dist, beforeDevCommand set to the appropriate dev command for your package manager (npm run dev, yarn dev, pnpm dev, or deno task dev), and beforeBuildCommand set to the appropriate build command (npm run build, yarn build, pnpm build, or deno task build).

Tauri configuration for Trunk

In tauri.conf.json, set beforeDevCommand to 'trunk serve', beforeBuildCommand to 'trunk build', devUrl to 'http://localhost:8080', frontendDist to '../dist', and enable withGlobalTauri in the app section.

Trunk configuration for Tauri

In Trunk.toml, add a [watch] section with ignore = ['./src-tauri'] to exclude the Rust source directory from watch, and a [serve] section with ws_protocol = 'ws' for proper hot-reload websocket functionality.

tauri.conf.json build configuration for SvelteKit with pnpm

For pnpm projects, set beforeDevCommand to 'pnpm dev', beforeBuildCommand to 'pnpm build', devUrl to 'http://localhost:5173', and frontendDist to '../build'.

Tauri frontendDist configuration for SvelteKit

Set 'build/' as the frontendDist value in tauri.conf.json when using SvelteKit.

tauri.conf.json build configuration for SvelteKit with yarn

For yarn projects, set beforeDevCommand to 'yarn dev', beforeBuildCommand to 'yarn build', devUrl to 'http://localhost:5173', and frontendDist to '../build'.

tauri.conf.json build configuration for SvelteKit with deno

For deno projects, set beforeDevCommand to 'deno task dev', beforeBuildCommand to 'deno task build', devUrl to 'http://localhost:5173', and frontendDist to '../build'.

frontendDist configuration for Vite

Set frontendDist to ../dist in src-tauri/tauri.conf.json when using Vite as the build tool.

Vite tauri.conf.json build configuration with pnpm

For pnpm, configure tauri.conf.json with: beforeDevCommand: "pnpm dev", beforeBuildCommand: "pnpm build", devUrl: "http://localhost:5173", frontendDist: "../dist"

Vite tauri.conf.json build configuration with deno

For deno, configure tauri.conf.json with: beforeDevCommand: "deno task dev", beforeBuildCommand: "deno task build", devUrl: "http://localhost:5173", frontendDist: "../dist"

Vite devUrl configuration for Tauri

The devUrl in tauri.conf.json should be set to http://localhost:5173, matching the development server port configured in vite.config.js.

Vite tauri.conf.json build configuration with yarn

For yarn, configure tauri.conf.json with: beforeDevCommand: "yarn dev", beforeBuildCommand: "yarn build", devUrl: "http://localhost:5173", frontendDist: "../dist"

Check TAURI_DEV_HOST environment variable for dev server configuration

When configuring the development server, check the `TAURI_DEV_HOST` environment variable instead of checking the `TAURI_ENV_PLATFORM` variable. If `TAURI_DEV_HOST` is set, use it to configure both the server host and HMR (hot module replacement) settings. This replaces the previous approach of detecting android/ios platform.

tauri.conf.json configuration file

The tauri.conf.json file is the main configuration file for Tauri, containing settings from the application identifier to the dev server URL. This file serves as a marker for the Tauri CLI to locate the Rust project.

Tauri 2.0 migration: configuration file changes

In Tauri 2.0, the configuration structure has changed significantly. The `productName` and `version` fields moved from `package` to the top level. The `package` object was removed entirely. The `tauri` key was renamed to `app`. The `mainBinaryName` string must be added at the top level matching `productName`. The `allowlist` was removed, refer to the new permissions system. The `bundle` object moved to the top level, and `bundle.identifier` moved to the top level.

Tauri 2.0 migration: more configuration changes

`tauri.allowlist.protocol.assetScope` moved to `app.security.assetProtocol.scope`. `tauri.cli` moved to `plugins.cli`. `tauri.windows.fileDropEnabled` renamed to `app.windows.dragDropEnabled`. `tauri.updater.active` and `tauri.updater.dialog` were removed. `tauri.updater` moved to `plugins.updater`. New `bundle.createUpdaterArtifacts` setting must be set when using the app updater, set to `v1Compatible` for apps already distributed in v1. `tauri.systemTray` renamed to `app.trayIcon`.

Tauri 2.0 migration: security and pattern configuration

`tauri.pattern` moved to `app.security.pattern`. `tauri.bundle.dmg` moved to `bundle.macOS.dmg`. `tauri.bundle.deb` moved to `bundle.linux.deb`. `tauri.bundle.appimage` moved to `bundle.linux.appimage`. License file paths consolidated: `tauri.bundle.macOS.license`, `tauri.bundle.windows.wix.license`, and `tauri.bundle.windows.nsis.license` all removed, use `bundle.licenseFile` instead. `tauri.bundle.windows.webviewFixedRuntimePath` removed, use `bundle.windows.webviewInstallMode` instead.

Tauri 2.0: Environment variables renamed

`TAURI_PRIVATE_KEY` renamed to `TAURI_SIGNING_PRIVATE_KEY`. `TAURI_KEY_PASSWORD` renamed to `TAURI_SIGNING_PRIVATE_KEY_PASSWORD`. `TAURI_SKIP_DEVSERVER_CHECK` renamed to `TAURI_CLI_NO_DEV_SERVER_WAIT`. `TAURI_DEV_SERVER_PORT` renamed to `TAURI_CLI_PORT`. `TAURI_PATH_DEPTH` renamed to `TAURI_CLI_CONFIG_DEPTH`. `TAURI_FIPS_COMPLIANT` renamed to `TAURI_BUNDLER_WIX_FIPS_COMPLIANT`. `TAURI_DEV_WATCHER_IGNORE_FILE` renamed to `TAURI_CLI_WATCHER_IGNORE_FILENAME`. `TAURI_TRAY` renamed to `TAURI_LINUX_AYATANA_APPINDICATOR`. `TAURI_APPLE_DEVELOPMENT_TEAM` renamed to `APPLE_DEVELOPMENT_TEAM`.

Tauri 2.0: Environment variables renamed (platform and debug)

`TAURI_PLATFORM` renamed to `TAURI_ENV_PLATFORM`. `TAURI_ARCH` renamed to `TAURI_ENV_ARCH`. `TAURI_FAMILY` renamed to `TAURI_ENV_FAMILY`. `TAURI_PLATFORM_VERSION` renamed to `TAURI_ENV_PLATFORM_VERSION`. `TAURI_PLATFORM_TYPE` renamed to `TAURI_ENV_PLATFORM_TYPE`. `TAURI_DEBUG` renamed to `TAURI_ENV_DEBUG`.

Use --alpha flag to bootstrap Tauri 2.0 alpha app

Pass the --alpha flag when creating a new Tauri app to bootstrap an application that uses tauri@2.0.0-beta. When adding the --alpha flag, create-tauri-app will automatically prompt whether to add mobile support. You can also use the --mobile flag to automatically make the app mobile compatible.

create-tauri-app version 3 separated language and package manager selection

create-tauri-app version 3 changed the prompt flow to first ask which frontend language to use (Rust or TypeScript/JavaScript), then if applicable ask which package manager to use (npm, yarn, or pnpm for JavaScript/TypeScript). This replaced the previous single prompt that asked only about package manager.

create-tauri-app version 3 split UI template selection into two prompts

create-tauri-app version 3 split template selection into two prompts: first prompt asks which UI template to use (Vanilla, Vue, Svelte, React, Solid, Angular, Next, SvelteKit, ClojureScript, Preact), then a second prompt asks for template-specific choices such as TypeScript vs JavaScript flavor. This replaced the previous single long prompt containing all options.

Custom protocol headers support on Linux in 1.2.0

The Linux webview binding in Tauri 1.2.0 now supports custom protocol headers when running on webkit2gtk version 2.36 or above. This fixes CORS issues on production when manually fetching build assets.

beforeDevCommand and beforeBuildCommand working directory configuration

Tauri 1.1.0 adds an option to configure the current working directory for beforeDevCommand and beforeBuildCommand.

TOML configuration format in Tauri 1.1.0

Tauri 1.1.0 adds TOML configuration support behind the config-toml Cargo feature. Configuration can be defined in a Tauri.toml file using TOML syntax. Tauri 1.0 supported JSON and JSON5 (with config-json5 feature), and 1.1.0 adds TOML as a third format option.

Tauri.toml configuration example

Example TOML configuration: [build] dev-path = "http://localhost:8000" dist-dir = "../dist"

Taurignore file support

Tauri 1.1.0 automatically uses any .taurignore file as ignore rules for the dev watcher and app path finder.

Give your agent this brain