Skip to main content
A provider tells a Configurate instance how to serialize and persist config data. You pass a provider to the Configurate constructor, and the plugin uses it for every read and write operation. All five provider functions return a frozen ConfigurateProvider value.

JsonProvider()

Stores config data as a human-readable, pretty-printed JSON file.
import { JsonProvider } from "tauri-plugin-configurate-api";

JsonProvider();
No options. Returns ConfigurateProvider.

YmlProvider()

Stores config data as a YAML file.
import { YmlProvider } from "tauri-plugin-configurate-api";

YmlProvider();
No options. Returns ConfigurateProvider.

TomlProvider()

Stores config data as a TOML file.
import { TomlProvider } from "tauri-plugin-configurate-api";

TomlProvider();
No options. Returns ConfigurateProvider.
TOML has no native null type. When a config object is saved, any field whose value is null is silently omitted from the TOML file. On the next load(), that key will be absent from the returned data. Use optional() schema fields to model nullable values and rely on the defaults option in Configurate to supply fallback values on read. Setting a non-optional field to null and saving it will cause that field to disappear on the next load.

BinaryProvider(opts?)

Stores config data as a compact binary file. Supports optional encryption with XChaCha20-Poly1305.
import { BinaryProvider } from "tauri-plugin-configurate-api";

BinaryProvider()                                          // Unencrypted (compact JSON bytes)
BinaryProvider({ encryptionKey: "key" })                  // Encrypted with SHA-256 KDF
BinaryProvider({ encryptionKey: "key", kdf: "argon2" })   // Encrypted with Argon2id KDF
Returns ConfigurateProvider.
opts.encryptionKey
string
Encryption key used to protect the binary file with XChaCha20-Poly1305. Omit to store data unencrypted.
opts.kdf
"sha256" | "argon2"
default:"\"sha256\""
Key derivation function applied to encryptionKey before encryption. "sha256" is fast; "argon2" uses Argon2id and is significantly more resistant to brute-force attacks.
BinaryProvider() without an encryptionKey stores data as compact JSON bytes with no confidentiality. Use BinaryProvider({ encryptionKey }) or the OS keyring() helper for sensitive values.
The on-disk format of unencrypted BinaryProvider() changed in v0.2.3. Files written by v0.2.2 or earlier must be re-created. Encrypted binary files (BinaryProvider({ encryptionKey })) are not affected by this change.

SqliteProvider(opts?)

Stores config data in a SQLite database. Schema fields are materialized as typed columns. SQLite handles durability internally via WAL mode.
import { SqliteProvider } from "tauri-plugin-configurate-api";

SqliteProvider()
SqliteProvider({ dbName: "app.db", tableName: "settings" })
Returns ConfigurateProvider.
opts.dbName
string
default:"\"configurate.db\""
File name of the SQLite database. The file is created in the resolved base directory.
opts.tableName
string
default:"\"configurate_configs\""
Name of the table used to store config entries.
Rolling backups (backup: true) have no effect with SqliteProvider. SQLite handles durability internally via WAL mode. File watching (watchExternal) is also not supported for SQLite and will throw if called.

Choosing a provider

ProviderHuman-readableEncryptionNull supportFile watching
JsonProviderYesNoYesYes
YmlProviderYesNoYesYes
TomlProviderYesNoNo (omitted)Yes
BinaryProviderNoOptionalYesYes
SqliteProviderNoNoYesNo

Full example

src/lib/config.ts
import {
  Configurate,
  JsonProvider,
  YmlProvider,
  TomlProvider,
  BinaryProvider,
  SqliteProvider,
  BaseDirectory,
  defineConfig,
} from "tauri-plugin-configurate-api";

const schema = defineConfig({ theme: String, fontSize: Number });

// JSON — plain text, easy to inspect
const jsonConfig = new Configurate({
  schema,
  fileName: "app.json",
  baseDir: BaseDirectory.AppConfig,
  provider: JsonProvider(),
});

// Binary with Argon2id KDF — strongest encryption
const encryptedConfig = new Configurate({
  schema,
  fileName: "app.bin",
  baseDir: BaseDirectory.AppConfig,
  provider: BinaryProvider({ encryptionKey: "my-secret-key", kdf: "argon2" }),
});

// SQLite — columnar storage, good for many configs
const sqliteConfig = new Configurate({
  schema,
  fileName: "app",
  baseDir: BaseDirectory.AppConfig,
  provider: SqliteProvider({ dbName: "app.db", tableName: "settings" }),
});

Build docs developers (and LLMs) love