Back to Blocks
PXL-829Done
No priority
Implement automated daily Supabase backup system
Labels
data1-circebackupsyncFeature
Summary
Implemented an automated daily backup system that exports all NutriKit Supabase database tables to GitHub for disaster recovery and data protection.
Documentation
Full documentation: NutriKit Supabase Backup System Documentation
What was implemented
Components
- ●Vercel Cron Job: Runs daily at 3 AM UTC via
/api/backupendpoint - ●Backup API (
app/api/backup/route.ts): Fetches all tables with pagination, filters sensitive data, compresses with gzip, uploads to GitHub - ●GitHub Repository: https://github.com/pxlshpr/nutrikit-backups (public)
Tables backed up
| Table | Rows | Compressed Size |
|---|---|---|
| users | 74 | ~3 KB |
| foods | 7,006 | ~2.5 MB |
| preferences | 43 | ~3 KB |
| days | 863 | ~139 KB |
| meals | 1,952 | ~456 KB |
| meal_items | 5,301 | ~1.4 MB |
| user_foods | 564 | ~39 KB |
| meal_presets | 0 | ~22 bytes |
Total: ~4.5 MB per backup
Security
- ●Sensitive fields excluded:
apple_user_id,cloudkit_id,device_ids - ●Authenticated via Bearer token (CRON_SECRET)
- ●Uses Supabase service role key to bypass RLS
Retention policy
- ●Last 30 days: Keep all daily backups
- ●30-90 days: Keep 1 per week
- ●90+ days: Keep 1 per month
Links
- ●Documentation: NutriKit Supabase Backup System Documentation
- ●Backup repo: https://github.com/pxlshpr/nutrikit-backups
- ●Production endpoint: https://nutri-kit.vercel.app/api/backup
Cost
$0/month (all free tiers)
Completed: 2026-01-02
Created Jan 2, 2026, 5:28 PM · Updated Jan 6, 2026, 12:45 PM