Skip to content

tauri-store ​

Persistent stores for Tauri.

NOTE

This is not an official Tauri plugin.

Features ​

  • Save your stores to disk.
  • Synchronize across multiple windows.
  • Debounce or throttle store updates.
  • Access the stores from both JavaScript and Rust.
  • Serialize and deserialize the stores into and from custom formats.
  • Define store migrations.

Framework support ​

The tauri-store crate is a framework-agnostic backend for store plugins. Currently, the following plugins are available:

NameVersionWorks with
tauri-storenpmEverything
@tauri-store/pinianpmVue, Nuxt
@tauri-store/sveltenpmSvelte
@tauri-store/valtionpmReact
@tauri-store/vuenpmVue, Nuxt
@tauri-store/zustandnpmReact

Examples ​

You can find example projects in the examples directory of the GitHub repository. To check them out, run the following commands:

sh
git clone https://github.com/ferreira-tb/tauri-store.git
cd tauri-store
pnpm install
pnpm run example [EXAMPLE_NAME]

For example, to run the pinia project, you can use:

sh
pnpm run example pinia

For a completely random example, run:

sh
pnpm run example random

Cargo features ​

You can enable some Cargo features to customize the plugin's behavior.

  • file-sync-all: calls File::sync_all after writing to the store file to ensure that all in-memory data reaches the filesystem. Enabling this can significantly degrade performance.
  • marshaler-cbor: enables the CBOR marshaler.
  • marshaler-ron: enables the RON marshaler.
  • marshaler-toml: enables the TOML marshaler.
  • preserve-order: preserve key order if the marshaler being used supports such feature.

Versioning ​

This crate follows Cargo guidelines for SemVer compatibility. However, features prefixed with unstable are experimental and may introduce breaking changes between minor versions or even be completely removed.

Any questions? ​

Feel free to open an issue on the GitHub repository or ask in our Discord server.