Back up — and prove the restore works
Every backup story has two halves and most people only do the first: taking the backup, and proving you can get it back. This capability does both — it sets up regular snapshot exports and then runs a RESTORE DRILL that actually recovers the data into a disposable preview and asserts it's intact. The drill reuses migrate-rehearse's exact primitives (snapshot export → preview deploy → snapshot import) pointed at recovery instead of a forward change, so the safety net is tested, not assumed.
Workflow
GUARD: deploy-guard — classify + announce the deployment being backed up (reading/exporting is safe; the drill's restore target is a throwaway preview, never prod).
TAKE the snapshot:
npx convex export --path backup-.zip
(add
--include-file-storage
if the app stores files). This is the backup artifact; treat it as sensitive real data.
SCHEDULE it (the ongoing half): recommend a cadence matched to how fast the data changes and how much loss is tolerable (RPO) — e.g. a daily
npx convex export
via CI/cron to durable storage the user controls, with a retention window. Convex's own platform backups exist; this adds a user-owned, portable copy.
RESTORE DRILL (the half almost nobody does — this is the point):
(a) PRECONDITION: a Preview Deploy Key as
CONVEX_DEPLOY_KEY
(same requirement as migrate-rehearse; a paid-tier feature). If unavailable, drill against a fresh personal dev deployment instead and say so.
(b) create a throwaway preview from the CURRENT code:
npx convex deploy --preview-create restore-drill-
.
(c) restore the snapshot into it:
npx convex import backup-.zip --deployment restore-drill- --replace
(import targets a deployment by NAME with
--deployment
; there is no
--preview-name
on import).
(d) ASSERT recovery: read the restored data back (MCP
tables
for row counts,
data
/
runOneoffQuery
for spot-checks) and confirm the critical tables came back with the expected row counts and a sample of real records — a restore that 'succeeds' but lands 0 rows is a FAILED drill. Compare against the source's counts where available.
REPORT the drill result plainly: what was backed up, that the restore was ACTUALLY performed and verified (or that it FAILED and why — a failed drill is the most valuable output, found before a real disaster), the recommended schedule + retention, and the recovery runbook (the exact commands to restore to prod:
npx convex import backup.zip --replace --prod
, gated by deploy-guard, with the post-snapshot-write-loss caveat stated).
HYGIENE: delete local snapshot copies when done (real data); the drill preview auto-expires. Never commit a backup file.
Show more
Installs
932
Repository
get-convex/agent-skills
GitHub Stars
42
First Seen
2 days ago
Security Audits
Gen Agent Trust Hub
Pass
Socket
Pass
Snyk
Pass