Prolifto
Developer guide

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, and DB_BACKUP_USER.
  • db:restore takes a safety backup of the current database before restoring.
  • Stop the app before restoring.
  • Use --skip-backup only 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 database

Scheduled local backups on Windows

pnpm db:backup:install-task

The 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-task

On Linux/macOS, schedule pnpm db:backup with cron.

Production

pnpm db:prod:check
pnpm db:prod:backup
pnpm db:prod:migrate
pnpm db:prod:check

Production commands read DATABASE_URL from Vercel through vercel env run -e production. Backups require Docker.

  • Run db:prod:check and db:prod:backup before a migration.
  • db:prod:backup verifies the dump before reporting success.
  • Run db:prod:check again after the migration.
  • Set PROLIFTO_VERCEL_PROJECT if the Vercel project is not prolifto.

Restore drill

A backup is only useful if it restores. Periodically:

  1. Take a fresh backup.
  2. Restore it into a scratch database.
  3. Run the app against the scratch database.
  4. Verify a product, order, invoice, and customer.
  5. 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.

On this page