Skip to content

tauri-store

Persistent stores for Tauri.

Features

  • Save your stores to disk.
  • Synchronize across multiple windows.
  • Debounce or throttle store updates.
  • Access the stores from both JavaScript and Rust.

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/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: call 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.
  • unstable-migration: allow to migrate stores from one version to another, making arbitrary changes to its structure.

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.