Scheduled snapshots restore a SQLite database to the moment each one was taken. Turn on continuous replication and ButlerDB also streams every change the app commits to your storage, within about a second, so you can restore to any moment: the minute before a bad migration, or before someone deleted the wrong rows.
Replication uses Litestream, the open-source SQLite replicator, run by ButlerDB for every replicated database on the server. Snapshots keep running on their schedule to every destination in the database's backup policy; replication adds one destination that receives each change as it happens. Litestream keeps a snapshot each day and every change since, and drops what's older than the window.
pragma journal_mode=wal), which most frameworks set already.ProxyJump).butlerdb install litestream.Litestream changes the database slightly: it adds two small tables,
_litestream_seq and _litestream_lock, and takes over checkpointing (folding the
write-ahead log back into the file). Apps don't notice, but don't run a second replicator, or your own
checkpoints, on the same file.
The section then shows the latest change on the replica and the oldest moment you can restore.
butlerdb install litestream
butlerdb sqlite replicate shop --to offsite --window 7d
butlerdb sqlite replica shop # status: latest change, how far back
butlerdb sqlite replicate shop --off # stop; what's on the destination stays
A restore writes a new file next to the live database and never touches the live one. Stop the app and swap the file in when you're ready, or copy the rows you need out of it.
Choose Restore to a Point in Time…, pick the date and time (or the latest replicated state) and the new file's path, and choose Restore.
butlerdb sqlite restore shop --at "2026-11-03 14:05" --to /srv/shop/restored.sqlite
butlerdb sqlite restore shop --at "15m ago" --to /srv/shop/restored.sqlite
butlerdb sqlite restore shop --at latest --to /srv/shop/restored.sqlite
Times are the server's local time unless written with a zone (2026-11-03T19:05:00Z). A moment
after the last change restores the latest state; one before the window is refused, and says how far
back the replica reaches. Older moments are still there in your snapshot backups.
Once a day ButlerDB restores the latest replicated state into scratch space and runs SQLite's full
integrity check, and the result joins the database's restore-test history (and its webhook, if one is
set). Run one any time with Test Restore or butlerdb sqlite replica shop --test.
If replication stops running, the database shows a backup warning in the app until it's back.
The replica is plain Litestream, so the stock litestream tool can restore it anywhere. It lives in
the destination under <instance>/litestream:
# a local or mounted folder
litestream restore -o shop.sqlite -timestamp 2026-11-03T19:05:00Z file:///Volumes/Backups/shop/litestream
# S3-compatible storage (credentials in LITESTREAM_ACCESS_KEY_ID / LITESTREAM_SECRET_ACCESS_KEY;
# for anything but AWS, add the endpoint)
litestream restore -o shop.sqlite "s3://my-bucket/prefix/shop/litestream?endpoint=https://s3.example.com"
Leave out -timestamp for the latest state. Use Litestream 0.5 or later.