Documentation

Security & Backups

A marketplace holds customer data and money flows — protect it with these habits. Most tasks need no developer.

On this page

Protecting accounts

Protecting secrets

Backups (database + uploads)

A complete backup has two parts: the database and the storage/ folder (uploaded images). Automate both.

Database — managed provider (recommended)

Supabase/Neon/RDS take daily snapshots automatically. Verify backups exist and, once, practice a restore. That's it.

Database — self-hosted server

# Manual dump (creates a compressed file with a date in the name)
pg_dump "YOUR_DATABASE_URL" | gzip > /backups/salex-$(date +%F).sql.gz

# Daily 3am automatic backup (cron)
crontab -e
0 3 * * * pg_dump "YOUR_DATABASE_URL" | gzip > /backups/salex-$(date +\%F).sql.gz

Uploads

tar -czf /backups/storage-$(date +%F).tar.gz /var/www/salex/storage
Copy backups off the server (S3, Backblaze, or your own machine via scp). A backup on the same disk as the data protects against almost nothing.
Running PostgreSQL on your own VPS? Use sudo -u postgres pg_dump salex (no password needed) and the ready-made nightly script in DigitalOcean VPS Setup → Automatic backups.

Restoring from backup

# Database
gunzip -c /backups/salex-2026-01-31.sql.gz | psql "YOUR_DATABASE_URL"

# Uploads
tar -xzf /backups/storage-2026-01-31.tar.gz -C /var/www/salex/

After a restore: restart the app (pm2 restart salex), log in, and spot-check orders and product images. Practice once on a test database — a backup you've never restored is a hope, not a backup.

Never run destructive SQL (DROP, TRUNCATE, DELETE without WHERE) on production — including “quick fixes” suggested in comment threads. If data is damaged, restore the newest backup instead.

Updates & dependency hygiene

Monitoring & logs

Maintenance checklist

FrequencyTaskWho
Daily (automated)Database backup runs; uptime monitor greenAutomation
WeeklyWebhook delivery check; scan logs for errors; storage backupStore owner
MonthlyRestore-test one backup; review admin user list; npm audit reviewStore owner
QuarterlyOS updates; dependency updates; rotate secrets if policy requiresOwner / developer
Before every updateFresh database + storage backup; note current SaleX versionOwner
Tasks marked “developer” (dependency major upgrades, schema changes, custom code) are good moments to engage the item's author or a freelance Next.js developer.