Configuration (tauri.conf.json)
Relevant source files
The following files were used as context for generating this wiki page:The tauri.conf.json file is the central manifest for the Scripty application. It governs every aspect of the Tauri application, from its identity and appearance to the build process, security policies, and native plugin integration. This file acts as the bridge between the web-based frontend (React + Vite) and the Rust backend, defining how they are packaged and behave as a cohesive desktop application.
This configuration file dictates metadata, window properties, bundle settings, and enables crucial features like the application updater. It directly references scripts and settings from other configuration files like package.json and vite.config.js to orchestrate the development and production builds.
General Application Information
This section defines the core identity of the Scripty application. The productName, version, and identifier are used by the operating system for installation, window titles, and application management. The version number is consistently maintained across the frontend (package.json), backend (Cargo.toml), and Tauri configuration.
| Property | Value | Description | Source |
|---|---|---|---|
productName | (S)cripty | The user-facing name of the application. | tauri.conf.json:3 |
version | 0.9.1 | The current version of the application. | tauri.conf.json:4, package.json:3, src-tauri/Cargo.toml:3 |
identifier | com.scripty.app | A unique reverse-DNS identifier for the application. | tauri.conf.json:5 |
Build Configuration
The build object specifies the commands and paths required to integrate the frontend with the Tauri backend for both development and production builds. It tells Tauri how to start the Vite development server and where to find the compiled frontend assets.
"build": {
"beforeDevCommand": "npm run dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "npm run build",
"frontendDist": "../dist"
}
Sources: src-tauri/tauri.conf.json:8-13
beforeDevCommand: Executes thenpm run devscript, which starts the Vite dev server.
Sources: package.json:6devUrl: Points Tauri to the Vite dev server, which is configured to run on port1420.
Sources: vite.config.js:18beforeBuildCommand: Executesnpm run buildto create a production build of the React frontend.
Sources: package.json:7frontendDist: Specifies the output directory for the production build assets.
The following diagram illustrates the development and build workflows orchestrated by this configuration.
Application Window Configuration
The app.windows array defines the properties of the main application window. Scripty is configured to use a single, frameless window, which allows for a custom title bar implemented in the React frontend.
| Property | Value | Description | Source |
|---|---|---|---|
title | (S)cripty | Default window title. | tauri.conf.json:17 |
width | 1000 | Initial width of the window in pixels. | tauri.conf.json:18 |
height | 650 | Initial height of the window in pixels. | tauri.conf.json:19 |
minHeight | 600 | Minimum window height. | tauri.conf.json:20 |
minWidth | 993 | Minimum window width. | tauri.conf.json:21 |
decorations | false | Hides the default OS window title bar and borders. | tauri.conf.json:22 |
transparent | true | Enables window transparency, used for custom styling. | tauri.conf.json:23 |
The decorations: false setting necessitates a custom implementation for window controls (close, minimize, maximize) and dragging. This is handled by the TopBar.jsx component, which uses a data-tauri-drag-region attribute and calls Tauri's window management APIs.
Sources: src/components/TopBar.jsx:25-28
Security Configuration
The app.security section configures the application's security policies. In Scripty, the Content-Security-Policy (csp) is set to null, which disables it. While this is simpler for development, it's a less secure configuration.
Security is primarily managed through a capabilities system. The src-tauri/capabilities/default.json file defines a list of permissions granted to the application, such as file system access (fs:default, fs:allow-appdata-write-recursive), dialogs (dialog:default), and the updater (updater:default). These permissions restrict what the frontend's JavaScript context can ask the Rust backend to do.
Sources: src-tauri/tauri.conf.json:26-28, src-tauri/capabilities/default.json
Bundle Configuration
The bundle object controls how the final application is packaged for distribution. It defines the application icon, target platforms, and whether to generate artifacts for the updater.
createUpdaterArtifacts: Whentrue, the build process generates a JSON manifest and a signature file alongside the main application bundle. These files are required by the updater plugin to verify and install new versions.active:trueenables the bundler.targets:"all"instructs Tauri to build for all possible targets on the current host OS.icon: An array of paths to icon files for different platforms and resolutions.
Sources: src-tauri/tauri.conf.json:31-46
Plugin Configuration
Updater Plugin
Scripty uses the tauri-plugin-updater to provide automatic application updates. The configuration in tauri.conf.json enables the plugin and specifies the endpoints to check for new releases.
"plugins": {
"updater": {
"active": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDQxRURENUVBNzg3NzAzMzUKUldRMUEzZDQ2dFh0UVl3VGRodXNtRmNWV2VFUkZpWWo0TWpnZXVMZ05XLzhYb0hkU1hPUng5NEYK",
"endpoints": [
"https://github.com/SemtexHR/ScriptTool/releases/latest/download/latest.json%22
]
}
}
Sources: src-tauri/tauri.conf.json:47-54
| Property | Description |
|---|---|
active | Enables the updater plugin. |
pubkey | The public key used to verify the signature of the update manifest, ensuring its authenticity. |
endpoints | A list of URLs where the update manifest (latest.json) can be found. |
This configuration is brought to life in App.jsx, which calls the updater plugin's check() function on application startup. If an update is found, it is automatically downloaded and installed, and the application is relaunched.
The following sequence diagram shows the update process:
Conclusion
The tauri.conf.json file is the cornerstone of the Scripty application's architecture. It provides a declarative and centralized way to manage the application's identity, build process, window behavior, security, and native features. By linking frontend scripts, backend capabilities, and plugin settings, it enables the seamless integration of web technologies with the power of a native desktop application framework. Understanding this file is essential for configuring, building, and extending the Scripty application.