Skip to main content
View as Markdown

Back up and restore a Sovrium SQLite database

On the SQLite default, all of an app's data lives in one database file inside SOVRIUM_DATA_DIR (default ./.sovrium/database.db). Backing it up is copying one file — but do it consistently, because SQLite runs in WAL mode with side files.

Take a consistent backup

Use SQLite's online backup so an in-flight write can't corrupt the copy (no downtime needed):

sqlite3 .sovrium/database.db ".backup '/backups/app-$(date +%F).db'"

For a whole-directory snapshot (database + uploaded files), stop the server first, then copy SOVRIUM_DATA_DIR in full.

Restore

Stop the app, replace the database file, and start again:

sovrium stop        # or systemctl stop / docker stop
cp /backups/app-2026-07-20.db .sovrium/database.db
rm -f .sovrium/database.db-wal .sovrium/database.db-shm
sovrium start app.ts

Verify

The startup summary reports the SQLite database, and your records are back. Automate the backup command with cron for off-site copies.

Next

Last updated July 21, 2026

This documentation was written with Claude Fable 5 (Anthropic), so errors or outdated content are possible. Sovrium is in beta — contributions and corrections are welcome.

Built with Sovrium