{"slug": "a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist", "title": "A Restore Is Not Undo: Holding My Own SaaS Up to My Backup Checklist", "summary": "A developer audited two of their own SaaS products — VoiceDash, a white-label client portal for Retell voice agents built on Next.js and Prisma over Supabase Postgres, and Upwork Scout, an AI job-alert tool on Firestore — against a self-written backup checklist and found that full point-in-time restores are the wrong recovery tool for multi-tenant apps. In VoiceDash, 21 of 23 Prisma relations use onDelete: Cascade, so deleting a single agent hard-deletes every imported conversation plus agency-entered tags and notes, and a database-wide restore would roll back an hour of data for every other tenant to recover one agency's records. The developer concludes that soft deletes (a deletedAt column with a 30-day purge job) and a pre-written per-tenant re-import script are the real fixes, and that neither exists in VoiceDash today.", "body_md": "I wrote a backup guide for small products on my own site. The short version: point-in-time recovery on, a second copy your own credentials cannot delete, an inventory of every place state lives outside the database, and one timed restore rehearsal. It is a reasonable checklist, and I still think it is right.\n\nThis week I held two of my own products up against it: VoiceDash (white-label client portals for Retell voice agents, Next.js + Prisma on Supabase Postgres) and Upwork Scout (AI-matched Upwork job alerts, Next.js on Firestore). The checklist assumes the disaster is a dead database or a bad migration. Reading my own code, the most likely disaster is much smaller than that, and a full restore is the wrong tool for it.\n\nMy first move was the lazy one:\n\n```\ngrep -ril \"backup\\|restore\" lib app\n```\n\nIn the Upwork Scout repo that matches four files: `lib/db.ts`, `lib/models.ts`, `lib/publicJobs.ts` and the scan route. None of them mention backups. Every single hit is the word **Firestore**, which happens to contain the letters r-e-s-t-o-r-e. Not a great start.\n\nVoiceDash has 23 Prisma models, and 21 relations are declared `onDelete: Cascade`. That is a sensible default for tenant data: delete a workspace and nothing orphaned is left behind. Then I followed one of those cascades from a button an agency can click.\n\n```\n// src/app/api/agents/[id]/route.ts\nexport async function DELETE(_req: Request, { params }: { params: Promise<{ id: string }> }) {\n  // ...auth, look up platform + platformAgentId\n  await prisma.agent.deleteMany({ where: { id, workspaceId } });\n  // ...hand the Retell webhook to another workspace if one is connected\n  return NextResponse.json({ success: true });\n}\n```\n\nAnd in the schema:\n\n```\nmodel Conversation {\n  agentId        String\n  platformCallId String\n  transcript     Json      @default(\"[]\")\n  tags           String[]  @default([])\n  note           String?\n  summary        String?\n  evaluation     String?\n  autoTags       String[]  @default([])\n  // ...\n  agent          Agent     @relation(fields: [agentId], references: [id], onDelete: Cascade)\n}\n```\n\nDeleting an agent hard-deletes every conversation imported for it, along with the tags and notes the agency typed onto those calls. The UI does ask first: `confirm(\"Delete this agent? This cannot be undone.\")`. That sentence is accurate, which is the problem. One misclick on the wrong row in the agents list and a client's whole call history in the portal is gone.\n\nPart of it can come back. The raw calls still live at Retell, and a new agent row starts with an empty `callsSyncedUntil` cursor, so reconnecting the agent should let a sync pull the calls in again, for as long as Retell keeps them. I have not tested that path end to end, so treat it as \"should\". The tags and notes cannot come back that way. They only ever existed in my database.\n\nSay Supabase point-in-time recovery is on, and I notice the deletion an hour later. A point-in-time restore rewinds the **whole database**. Every other agency loses an hour of imported calls, new client logins, settings changes and webhook rows, to bring back one agency's notes.\n\nOn a multi-tenant product, a restore is not undo. It is a time machine for everyone at once. The checklist item \"restore into a separate environment\" turns out to be the real recovery method here, not just the rehearsal:\n\n`Conversation` rows for one `agentId`) back into production.\nThat is a script, and it has to be written before the day you need it. Mine does not exist yet.\n\nThe cheaper fix is not to need it. A `deletedAt` column on `Agent`, a route that sets it instead of deleting, and a scheduled job that purges after 30 days turns \"restore a database\" into \"flip one field\". VoiceDash has no `deletedAt` or archive flag on any model today. My guide listed soft deletes under \"preventing the restore in the first place\", and I wrote that line without checking my own schema.\n\nUpwork Scout taught me a different lesson: rewinding some state is worse than losing it.\n\nThe scan runs every 15 minutes. It uses two collections as memory of what already happened:\n\n``` js\n// app/api/cron/scan/route.ts\nconst ref = jobsCol().doc(job.id);\nif (!(await ref.get()).exists) {\n  await ref.set(job);\n  newJobs.push(job);          // \"new\" = not in the jobs collection yet\n}\n// ...per user\nconst dRef = deliveriesCol().doc(`${u.uid}_${j.id}`);\nif ((await dRef.get()).exists) continue;   // already alerted this user\n```\n\n`jobs` is the \"have I seen this posting\" ledger and `deliveries` is the \"have I emailed this person about it\" ledger. The daily alert cap lives on the user document as `alertsSentToday`.\n\nNow restore Firestore to an hour ago. All three rewind together. Any job fetched in the last hour that is still inside the 24-hour freshness window (`JOB_MAX_AGE_HOURS` defaults to 24) is \"new\" again on the next scan, the delivery record that would have stopped a repeat is gone, and the cap counter says the user has room. So users get the same job alerts a second time. Email is the one side effect you cannot pull back.\n\nThe fix I would write into the runbook: after any restore, pause the scan (the workflow is a pinger, so disabling it is one click), let the freshness window pass or backfill the `deliveries` ledger from the email provider's send log, then resume. None of that is in the repo either.\n\nLayer three of my guide is \"everything that is not in the database\". For these two products, from the code:\n\n| State | Where | Comes back how | \n|---|---|---|\n| Users, workspaces, clients, calls | Supabase Postgres | Provider backups (plan tier not verified from this machine) | \n| Raw calls, recordings | Retell | Re-sync, within Retell's retention | \n| Tags, notes on calls | Postgres only | Backup restore to a side database + row copy | \n| Alert subscribers, AI match verdicts | Firestore | Point-in-time recovery, if enabled; not on by default | \n| Seen-jobs and sent-alerts ledgers | Firestore | Must be restored together, then reconciled | \n| Config | Vercel env | Partly documented | \n\nThat last row stung. Upwork Scout ships a `.env.local.example` with 5 variables; the real file has 9. The missing four include the Anthropic key name and the global daily fetch budget that caps scraping spend. VoiceDash has about 30 application variables (Stripe price IDs, Wise payment links, Retell, Vapi, Resend, Supabase) and no example file at all. If the Vercel project vanished, I would be rebuilding that list from `grep process.env`.\n\nI also could not answer the first question in my own guide for either product: is point-in-time recovery actually switched on? Neither repo can tell you, because it is a console setting. That belongs in the README, with the date someone last looked.\n\nIn order, cheapest first:\n\n`Agent` (and `Client`) in VoiceDash with a delayed purge.` restore-rows.ts` script that copies one tenant's rows from a restored side database.`deliveries`, resume.\nNone of this is shipped yet. I am publishing the list because the gap between the guide and the repos was more useful to me than the guide.\n\nThe lesson I keep relearning: backup advice is written for the disaster that kills everything. A small multi-tenant SaaS is far more likely to meet the disaster that kills one customer's data through a button that works exactly as designed. Plan the undo for that one first.\n\nIf you run a multi-tenant app: when one customer deletes something by mistake, what is your actual recovery path? A soft delete, a side-database row copy, or \"sorry\"?\n\n*Adapted from my original guide, [Backups and disaster recovery for a small product](https://nabeelbaghoor.com/blog/backups-disaster-recovery-small-product/). Related: [My Unique Index Decided Which Customer Owned Each Phone Call](https://dev.to/nabeelbaghoor/my-unique-index-decided-which-customer-owned-each-phone-call-12k) and [I Wrote a Guide to Kill Switches. Then I Grepped My Own Code.](https://dev.to/nabeelbaghoor/i-wrote-a-guide-to-kill-switches-then-i-grepped-my-own-code-5d53)*", "url": "https://wpnews.pro/news/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist", "canonical_source": "https://dev.to/nabeelbaghoor/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist-1po8", "published_at": "2026-11-24 21:36:52+00:00", "updated_at": "2026-11-24 21:44:19.049581+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-startups"], "entities": ["VoiceDash", "Upwork Scout", "Retell", "Supabase", "Prisma", "Firestore", "Next.js", "Upwork"], "also_reported_by": [], "takeaway": "On multi-tenant apps, onDelete: Cascade plus a full point-in-time restore means one misclick wipes a tenant's data and recovery rewinds every other tenant; add a deletedAt soft-delete column with a scheduled purge and write a per-tenant re-import script before you need it.", "recommendation": {"advice": "Audit your schema for onDelete: Cascade on tenant data and replace hard deletes with a deletedAt column plus a scheduled purge, since a full restore rolls back every tenant at once.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist", "markdown": "https://wpnews.pro/news/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist.md", "text": "https://wpnews.pro/news/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist.txt", "jsonld": "https://wpnews.pro/news/a-restore-is-not-undo-holding-my-own-saas-up-to-my-backup-checklist.jsonld"}}