Complete backup solution for Supabase database and storage buckets. Creates a single zip file containing your entire project data for easy restoration.
- Database: Exports all inventory table data to JSON (pagination handles unlimited rows)
- Storage: Downloads all files from
inventory-imagesandinventory-videosbuckets - Packaging: Creates single dated zip file (e.g.,
backup-2025-07-31.zip) - Reliability: Retry logic handles network issues and rate limiting
-
Add GitHub Secrets:
- Go to repo Settings → Secrets and variables → Actions
- Add
SUPABASE_URLandSUPABASE_SERVICE_KEY - Secrets are encrypted and private (not visible in public repos)
-
Workflow runs automatically:
- Daily at 6 AM UTC (1 AM EST / 2 AM EDT)
- Manual trigger available in Actions tab
- Install dependencies:
npm install - Create
.envfile:SUPABASE_URL=your_project_url SUPABASE_SERVICE_KEY=your_service_role_key - Run backup:
node backup.js
Creates a complete backup zip file containing:
backup-2025-07-31/
├── inventory-backup.json # Complete database export
├── inventory-images/ # All image files
└── inventory-videos/ # All video files (if any)
Recovery: Simply unzip the file to restore all data.
✅ Automated Daily Backups: GitHub Actions runs daily at 6 AM UTC
✅ 30-Day Retention: Backup artifacts stored for 30 days
✅ Manual Trigger: Can run on-demand via Actions tab
- Backups stored as GitHub artifacts for 30 days
- Download manually from Actions tab when needed
- Free and reliable
- Add automatic upload to Google Drive after backup creation
- Unlimited retention (or your Drive storage limit)
- Requires Google Drive API setup
- Get notified when backups succeed/fail
- Simple status monitoring
- Easy to add to existing workflow
.github/workflows/backup.yml- GitHub Actions automationbackup.js- Main backup scriptpackage.json- Dependencies.env- Supabase credentials (not committed, local only)backup-*/- Local backup folders (ignored)*.zip- Compressed backup files (ignored)