Skip to main content
Configurate resolves the storage location for a config file from four inputs you provide in the constructor: baseDir, options.dirName, options.currentPath, and fileName. Understanding how these combine lets you place config files exactly where platform conventions expect them.

The four path inputs

OptionRequiredDescription
baseDirYesA Tauri BaseDirectory enum value that anchors the path to a platform-specific directory.
options.dirNameNoWhen set, replaces the app-identifier segment of baseDir or is appended as a sub-directory.
options.currentPathNoA sub-directory appended after the directory resolved from baseDir and dirName.
fileNameYesThe config file name. Must be a single file name — no path separators allowed.
The resolved path is:
{resolvedBaseDir}/{dirName?}/{currentPath?}/{fileName}
where resolvedBaseDir is the absolute platform path for the given BaseDirectory.

baseDir

baseDir is a value from the BaseDirectory enum re-exported from @tauri-apps/api/path. Common values for config files:
ValueTypical use
BaseDirectory.AppConfigPer-user application configuration (recommended default)
BaseDirectory.AppDataPer-user application data
BaseDirectory.AppLocalDataPer-user local application data (Windows-specific distinction)
BaseDirectory.HomeUser’s home directory
BaseDirectory.DesktopUser’s desktop
import { BaseDirectory, Configurate, JsonProvider } from "tauri-plugin-configurate-api";

const config = new Configurate({
  schema: appSchema,
  fileName: "settings.json",
  baseDir: BaseDirectory.AppConfig,
  provider: JsonProvider(),
});
On most platforms, AppConfig already includes an app-specific segment based on the Tauri app identifier (e.g. com.example.my-app).

options.dirName

dirName controls the app-identifier segment of the resolved base directory. When baseDir points to a directory whose last path segment is the app identifier (as is the case for AppConfig, AppData, and similar values), dirName replaces that segment. When baseDir does not end with the app identifier, dirName is appended as a new sub-directory. This lets you use a short, human-friendly directory name instead of the full reversed-domain app identifier:
options: {
  dirName: "my-app", // replaces "com.example.my-app" with "my-app"
}
dirName must not contain empty or special path segments (. or ..), but it can contain forward slashes to create nested directories:
options: {
  dirName: "my-app/config",
}

options.currentPath

currentPath is appended after the directory resolved from baseDir and dirName. Use it to organize configs into sub-directories without affecting the root directory name:
options: {
  dirName: "my-app",
  currentPath: "v2",
}
Like dirName, currentPath must not contain empty or special segments.

fileName

fileName is the name of the config file itself. It is validated at construction time:
fileName must be a single file name — it must not contain / or \ (path separators). Attempting to use a path like "config/settings.json" throws immediately:
Error: "fileName" must be a single filename and cannot contain path separators.
Additionally, fileName must not be "." or "..".

Complete path example

The following constructor:
new Configurate({
  schema: appSchema,
  fileName: "settings.json",
  baseDir: BaseDirectory.AppConfig,
  provider: JsonProvider(),
  options: {
    dirName: "my-app",
    currentPath: "v2",
  },
});
resolves to:
C:\Users\<user>\AppData\Roaming\my-app\v2\settings.json

Path option reference

OptionEffect
baseDirAnchors the path to a Tauri BaseDirectory platform path.
options.dirNameReplaces the app-identifier segment when it is the last segment of the baseDir path; otherwise appended as a sub-directory.
options.currentPathSub-directory appended after the dirName root.
fileNameSingle file name — must not contain path separators, and must not be "." or "..".

Without options

If neither dirName nor currentPath is set, the file is placed directly inside the platform’s default directory for the given baseDir. For AppConfig, the directory includes the Tauri app identifier:
C:\Users\<user>\AppData\Roaming\com.example.my-app\settings.json
Use options.dirName to replace the reversed-domain app identifier with a shorter name. This keeps paths clean for users who inspect the file system directly and avoids overly long paths on Windows.

SQLite path behavior

SqliteProvider uses the same path resolution logic, but fileName is the SQLite database file name (dbName option), not the config file name. The fileName constructor option becomes the config_key stored inside the database table — it identifies the row, not a file on disk.
new Configurate({
  schema: appSchema,
  fileName: "app-settings",   // becomes the config_key in the SQLite table
  baseDir: BaseDirectory.AppConfig,
  provider: SqliteProvider({ dbName: "configurate.db", tableName: "configs" }),
  options: { dirName: "my-app" },
});
// Database file: ~/.config/my-app/configurate.db
// Row: config_key = "app-settings"

Build docs developers (and LLMs) love