Backup Restore
Backup Restore — ɳSelf documentation.
Guide: Backup and Restore
Protect your data with regular, tested backups.
Automated Backups (Recommended)
Install the backup plugin for scheduled, automated backups:
nself plugin install backup
nself build && nself restart
Configure schedule and retention in .env:
BACKUP_SCHEDULE=0 2 * * * # daily at 2am
BACKUP_RETENTION_DAYS=30 # keep 30 days
BACKUP_S3_BUCKET=my-backup-bucket # optional: upload to S3/MinIO
Manual Database Backup
nself db dump
Writes a pg_dump file to .nself/backups/ with a timestamped filename.
Backup to S3 / MinIO
Configure in .env (or .env.secrets):
BACKUP_S3_ENDPOINT=https://s3.amazonaws.com
BACKUP_S3_BUCKET=my-backups
BACKUP_S3_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE
BACKUP_S3_SECRET_KEY=<secret>
Compatible with AWS S3, MinIO, Cloudflare R2, Backblaze B2, and any S3-compatible provider.
Restore from Backup
nself db restore .nself/backups/myproject_20260328_020000.sql
The restore command:
- Stops application services (keeps Postgres running)
- Drops and recreates the target database
- Restores from the dump file
- Restarts services
Important: Test your restores regularly. Untested backups are not backups.
Backup Verification Checklist
- Backup job runs successfully (check logs:
nself logs backup) - Backup files appear in
.nself/backups/or S3 bucket - Restoration test succeeds on a staging instance
- Retention policy removes old files as expected
See Also
- plugin-backup: backup plugin reference
- cmd-db: db command reference
- Guide-Production-Deployment: server setup