Database Backup & Restore
Export and restore selected Payload CMS MongoDB collections as portable JSON from the admin panel.
Installation
pnpm add @yairl/payload-db-backup-restore About
This plugin adds a backup and restore screen to a Payload 3 admin panel. Pick the collections you want from a checklist, hit download, and you get a single JSON file with every document in those collections. Restore reads that file back and reinserts the rows. The whole thing mounts at `/admin/backup` and adds a sidebar shortcut by default. The file is written with EJSON, so MongoDB types like `ObjectId`, `Date`, and `Decimal128` round-trip byte for byte rather than degrading into plain strings. When a collection has drafts enabled, its `_<slug>_versions` sidecar is exported and restored alongside the main slug automatically. Restore uses raw Mongoose `insertMany`, not `payload.create`. That is deliberate: Payload hooks such as `beforeChange` and `afterChange` do not fire, so a bulk restore will not re-run title setters or trigger thousands of revalidation calls. The `_id` of each document is preserved exactly as it was in the backup. There is a "drop before restore" option, on by default, that empties the target collection first; turn it off and `insertMany` runs with `ordered: false`, so duplicate `_id` rows error individually while the rest succeed. It is MongoDB only. The code reaches into `req.payload.db.collections` and `db.versions`, and the Postgres and SQLite adapters do not expose the same shape. It also does not cover uploaded blob files on disk, global admin settings, or Payload's internal system collections. Access defaults to a `req.user.roles.includes('admin')` check, which you will likely want to override to `req => !!req.user` unless you have added a `roles` field to your Users collection. Three REST endpoints sit behind that same check if you want to script backups from outside the admin UI.
Package info
- Package name
@yairl/payload-db-backup-restore- Latest version
0.1.2- Unpacked size
- 62 kB
- License
- MIT
- Weekly downloads
- 35
- Last publish
- Jul 17, 2026
More from ylahav
View profileSimilar plugins
More in AdminEcommerce Product Reviews
Adds product reviews and aggregate ratings to a Payload ecommerce shop, with verified-purchase detection and moderation before reviews go public.
Refunds
Adds full and partial refund records to Payload ecommerce orders, with per-line caps, optional restock, and an append-only audit trail.
Fulfillment
Adds fulfillment states, transition history, internal notes and tracking fields to Payload ecommerce orders.
Live Preview
Live preview for Payload CMS in Astro and any SSR/static frontend (SvelteKit, Nuxt, Next.js, plain HTML), patching the DOM without rebuilds.
Reservation and Booking Manager
Manage reservations and bookings through Payload CMS with conflict detection and scheduling.
SEO Analyzer
Payload plugin that audits page SEO in the editor sidebar with 50+ checks, a dashboard, score history, redirects and IndexNow.