Backups and restore
Back up, verify, and restore local and production databases.
Prolifto uses PostgreSQL. Backups are compressed pg_dump archives. Local
backups go to backups/; production backups go to backups/prod/. Both are
git-ignored.
Backups contain production data. Do not commit them, share them, or leave them in insecure locations. Apply a retention policy and move production backups to secure storage.
Local development
pnpm db:backup
pnpm db:backup:verify
pnpm db:restore
pnpm db:restore backups/prolifto_dev-2026-10-25T12-00-00-000Z.dump --yes- The most recent 14 days are kept by default.
- Override with
DB_BACKUP_RETENTION_DAYS,DB_BACKUP_DIR,DB_BACKUP_SERVICE,DB_BACKUP_DATABASE, andDB_BACKUP_USER. db:restoretakes a safety backup of the current database before restoring.- Stop the app before restoring.
- Use
--skip-backuponly when the current database cannot be dumped.
Reset commands:
pnpm db:dev:reset # takes a backup first
pnpm db:dev:reset:force # no backup; use only for a broken databaseScheduled local backups on Windows
pnpm db:backup:install-taskThe task waits for Docker and logs to backups/scheduled-backup.log. Change the
time or name:
pnpm db:backup:install-task -Time 02:00 -TaskName "Prolifto Nightly Backup"Remove it with:
pnpm db:backup:uninstall-taskOn Linux/macOS, schedule pnpm db:backup with cron.
Production
pnpm db:prod:check
pnpm db:prod:backup
pnpm db:prod:migrate
pnpm db:prod:checkProduction commands read DATABASE_URL from Vercel through
vercel env run -e production. Backups require Docker.
- Run
db:prod:checkanddb:prod:backupbefore a migration. db:prod:backupverifies the dump before reporting success.- Run
db:prod:checkagain after the migration. - Set
PROLIFTO_VERCEL_PROJECTif the Vercel project is notprolifto.
Restore drill
A backup is only useful if it restores. Periodically:
- Take a fresh backup.
- Restore it into a scratch database.
- Run the app against the scratch database.
- Verify a product, order, invoice, and customer.
- Delete the scratch database.
Production retention
Use managed point-in-time recovery or pgBackRest/WAL-G with offsite storage.
Keep an offsite copy separate from the application provider, and document who
can restore it.