Enabling rolling backups
Passbackup: true to the Configurate constructor:
create, save, patch, reset — works exactly as before.
The three backup slots
Each write rotates the existing backups and copies the current file to.bak1:
| File | Contents |
|---|---|
app.json.bak1 | The file as it was immediately before the most recent write |
app.json.bak2 | The file as it was before the second-to-last write |
app.json.bak3 | The file as it was before the third-to-last write |
.bak3) is overwritten on each new write once all three slots are full. The file itself (app.json) always reflects the current data.
Auto-deletion on app exit
All backup files (.bak1, .bak2, .bak3) are automatically deleted when the Tauri application exits cleanly. This keeps the application data directory tidy and prevents backups from accumulating across sessions.
If the application is force-killed (e.g. via Task Manager or
kill -9), the cleanup hook may not run and backup files could remain on disk. This is intentional — an abnormal exit is exactly the scenario where you may want the backups to survive for recovery.Provider support
Rolling backups work with every file-based provider:| Provider | Backups supported |
|---|---|
JsonProvider() | Yes |
YmlProvider() | Yes |
TomlProvider() | Yes |
BinaryProvider() | Yes |
SqliteProvider() | No |
SQLite is not affected by the
backup option. SQLite manages durability internally through WAL (Write-Ahead Logging) mode, which already provides atomic writes and crash recovery. Setting backup: true with SqliteProvider is silently ignored.Restoring from a backup
The plugin does not yet expose a built-in restore command. To restore from a backup manually, use the Tauri filesystem API to copy the desired backup slot over the main file.Locate the config directory
Use Tauri’s
appConfigDir() (or the appropriate base directory) to get the path where your config file is stored.Copy the backup over the main file
To restore from the most recent backup (
.bak1), copy it over app.json: