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
- Change the seeded admin password immediately after first login (Account → Security).
- Use RBAC for staff: create roles with only the permissions needed (Admin → Roles). Support staff rarely need payment settings.
- One account per person. Shared admin accounts make audit trails useless — every sensitive action is logged with the actor.
- Vendors are isolated by design: they can only ever see their own orders/products — the server enforces this. Never “share” admin credentials with a vendor.
- HTTPS is mandatory once real users exist (see Domain, SSL & Email).
Protecting secrets
.envnever goes into Git, screenshots, or support tickets. On servers, keep it readable only by the app user:chmod 600 .env.- Different secrets per environment: local, staging, and production each get their own AUTH_SECRET and payment keys.
- Rotate any key that may have leaked (provider dashboards allow key rotation) and restart the app.
- Payment credentials entered in the admin panel are stored encrypted-at-rest in the database and never sent to the browser.
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.gzUploads
tar -czf /backups/storage-$(date +%F).tar.gz /var/www/salex/storageCopy 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
- Apply SaleX updates per Updates & Upgrading — always after a fresh backup.
- Review
npm auditoutput occasionally; apply security updates for dependencies when published. - Update the OS periodically (
apt update && apt upgrade -y).
Monitoring & logs
- Uptime monitor (UptimeRobot, Better Stack — free tiers): ping your homepage every 5 minutes and alert on failure.
- Application logs:
pm2 logs salex --lines 100— read after any incident; errors show the failing route. - Nginx access/error logs:
/var/log/nginx/— traffic and proxy errors. - Payment dashboards: check webhook delivery status weekly — silent webhook failures are the #1 cause of “paid but unpaid” orders.
Maintenance checklist
| Frequency | Task | Who |
|---|---|---|
| Daily (automated) | Database backup runs; uptime monitor green | Automation |
| Weekly | Webhook delivery check; scan logs for errors; storage backup | Store owner |
| Monthly | Restore-test one backup; review admin user list; npm audit review | Store owner |
| Quarterly | OS updates; dependency updates; rotate secrets if policy requires | Owner / developer |
| Before every update | Fresh database + storage backup; note current SaleX version | Owner |
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.