Adds a DB consistency page and sidebar shortcut to the Payload admin. It checks any collection for duplicates, broken references, one-sided relationships and drafts documents missing a latest version. Repairs such as merging duplicates, clearing or rebuilding references and backfilling versions are opt-in and preview first. Requires Payload 3, and reference rebuild reads from another MongoDB database on the same server.
Admin UI for Payload CMS that reports database consistency problems (duplicates, broken references, one-sided relationships) across any collection, with opt-in repairs: merge duplicates, clear or rebuild references. Includes a /admin/db-check view and a sidebar shortcut.
Installation
npm i @yairl/payload-db-check0
Stars
0
Forks
1
Open Issues
4 months ago
Last Updated
10
Weekly Downloads
v0.2.0
npm Version
318.3 KB
Unpacked Size
0
Dependencies
00 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
| Oct 24, 2026 | 0 |
| Oct 23, 2026 | 0 |
| Oct 22, 2026 | 0 |
| Oct 21, 2026 | 0 |
| Oct 20, 2026 | 0 |
| Oct 19, 2026 | 0 |
| Oct 18, 2026 | 0 |
| Oct 17, 2026 | 0 |
| Oct 16, 2026 | 0 |
| Oct 15, 2026 | 0 |
| Oct 14, 2026 | 0 |
| Oct 13, 2026 | 0 |
| Oct 12, 2026 | 0 |
| Oct 11, 2026 | 0 |
| Oct 10, 2026 | 0 |
| Oct 9, 2026 | 0 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 0 |
| Sep 23, 2026 | 0 |
| Sep 22, 2026 | 0 |
| Sep 21, 2026 | 0 |
| Sep 20, 2026 | 0 |
| Sep 19, 2026 | 0 |
| Sep 18, 2026 | 0 |
| Sep 17, 2026 | 0 |
| Sep 16, 2026 | 0 |
| Sep 15, 2026 | 0 |
| Sep 14, 2026 | 0 |
| Sep 13, 2026 | 0 |
| Sep 12, 2026 | 0 |
| Sep 11, 2026 | 0 |
| Sep 10, 2026 | 0 |
| Sep 9, 2026 | 0 |
| Sep 8, 2026 | 0 |
| Sep 7, 2026 | 0 |
| Sep 6, 2026 | 0 |
7−1 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 7 |
| Dec 4, 2026 | 6 |
| Dec 3, 2026 | 6 |
| Dec 2, 2026 | 4 |
| Dec 1, 2026 | 8 |
| Nov 30, 2026 | 8 |
| Nov 29, 2026 | 7 |
| Nov 28, 2026 | 7 |
| Nov 27, 2026 | 9 |
| Nov 26, 2026 | 9 |
| Nov 25, 2026 | 10 |
| Nov 24, 2026 | 21 |
| Nov 23, 2026 | 21 |
| Nov 22, 2026 | 22 |
| Nov 21, 2026 | 21 |
| Nov 20, 2026 | 20 |
| Nov 19, 2026 | 21 |
| Nov 18, 2026 | 21 |
| Nov 17, 2026 | 6 |
| Nov 16, 2026 | 7 |
| Nov 15, 2026 | 5 |
| Nov 14, 2026 | 5 |
| Nov 13, 2026 | 3 |
| Nov 12, 2026 | 2 |
| Nov 11, 2026 | 1 |
| Nov 10, 2026 | 3 |
| Nov 9, 2026 | 4 |
| Nov 8, 2026 | 4 |
| Nov 7, 2026 | 4 |
| Nov 6, 2026 | 10 |
| Nov 5, 2026 | 10 |
| Nov 4, 2026 | 10 |
| Nov 3, 2026 | 8 |
| Nov 2, 2026 | 7 |
| Nov 1, 2026 | 7 |
| Oct 31, 2026 | 8 |
| Oct 30, 2026 | 2 |
| Oct 29, 2026 | 2 |
| Oct 28, 2026 | 2 |
| Oct 27, 2026 | 4 |
| Oct 26, 2026 | 4 |
| Oct 25, 2026 | 4 |
| Oct 24, 2026 | 5 |
| Oct 23, 2026 | 5 |
| Oct 22, 2026 | 12 |
| Oct 21, 2026 | 12 |
| Oct 20, 2026 | 10 |
| Oct 19, 2026 | 9 |
| Oct 18, 2026 | 14 |
| Oct 17, 2026 | 16 |
| Oct 16, 2026 | 18 |
| Oct 15, 2026 | 14 |
| Oct 14, 2026 | 15 |
| Oct 13, 2026 | 15 |
| Oct 12, 2026 | 16 |
| Oct 11, 2026 | 13 |
| Oct 10, 2026 | 10 |
| Oct 9, 2026 | 9 |
| Oct 8, 2026 | 7 |
| Oct 7, 2026 | 7 |
| Oct 6, 2026 | 7 |
| Oct 5, 2026 | 7 |
| Oct 4, 2026 | 5 |
| Oct 3, 2026 | 6 |
| Oct 2, 2026 | 6 |
| Oct 1, 2026 | 5 |
| Sep 30, 2026 | 7 |
| Sep 29, 2026 | 7 |
| Sep 28, 2026 | 6 |
| Sep 27, 2026 | 8 |
| Sep 26, 2026 | 9 |
| Sep 25, 2026 | 9 |
| Sep 24, 2026 | 9 |
| Sep 23, 2026 | 8 |
| Sep 22, 2026 | 9 |
| Sep 21, 2026 | 13 |
| Sep 20, 2026 | 12 |
| Sep 19, 2026 | 9 |
| Sep 18, 2026 | 9 |
| Sep 17, 2026 | 12 |
| Sep 16, 2026 | 14 |
| Sep 15, 2026 | 13 |
| Sep 14, 2026 | 9 |
| Sep 13, 2026 | 8 |
| Sep 12, 2026 | 8 |
| Sep 11, 2026 | 9 |
| Sep 10, 2026 | 6 |
| Sep 9, 2026 | 2 |
| Sep 8, 2026 | 3 |
| Sep 7, 2026 | 4 |
| Sep 6, 2026 | 8 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1303697862-root)<a href="https://payloaddirectory.dev/plugins/1303697862-root"><img src="https://payloaddirectory.dev/badge/1303697862-root.svg" alt="Payload Directory"></a>README
An admin plugin for Payload CMS 3 that finds and fixes database consistency problems across your collections — without leaving the admin panel.
It adds a DB consistency page and a sidebar shortcut. Everything is read-only until you explicitly run a repair, and every repair previews what it will do first.
Pick a collection, choose which checks to run, and press Start checks:
fullName +
birthday). The first key field is the "primary identity", so records sharing
it but differing on the rest are surfaced separately as likely-but-unconfirmed
duplicates.latest version row. Because the admin list reads through the versions system
(draft=true), such a document is live and served publicly yet invisible in
the admin list. This happens after a bulk insert, or when drafts is enabled
on a collection that already had data. Only offered for collections with drafts.All repairs are opt-in, preview first, and require confirmation.
latest version, making it visible in the
admin list again. Document content is not changed. Backfill all missing, or
tick specific rows and backfill only those. Idempotent — a document that
already has a latest version is skipped, so a re-run is a no-op.Merging deletes records, so it is opt-in per collection via the mergeable
option. Checks run against any collection.
pnpm add @yairl/payload-db-check
Peer dependencies (you already have these in a Payload 3 app): payload,
@payloadcms/next, @payloadcms/ui, react.
// payload.config.ts
import { buildConfig } from 'payload'
import { dbCheckPlugin } from '@yairl/payload-db-check'
export default buildConfig({
// ...
plugins: [
dbCheckPlugin({
// Collections that may be merged (merging deletes records). Optional.
mergeable: ['contacts', 'people'],
// Suggested duplicate key per collection, prefilled in the UI. Optional.
defaultKeyFields: {
people: ['fullName', 'birthday'],
contacts: ['fullName', 'phone'],
},
}),
],
})
Then regenerate the admin import map so it can resolve the view:
payload generate:importmap
Open /admin/db-check (or your custom route), or use the sidebar link. The
sidebar link shows a badge with the total number of documents missing a latest
version across all drafts-enabled collections, so the problem is visible without
opening the page first.
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Set false to leave the config untouched (e.g. per environment). |
mergeable | string[] | [] | Collection slugs that may be merged. Merging deletes records, so it is opt-in. |
defaultKeyFields | Record<string, string[]> | {} | Suggested duplicate key per collection slug, prefilled in the UI. |
route | `/${string}` | /db-check | Admin route for the page, relative to /admin. |
showInSidebar | boolean | true | Add a link to the admin sidebar. |
access | (req) => boolean | Promise<boolean> | any logged-in user | Who may run checks and repairs. Reports can expose personal data; repairs delete. |
packageName | string | @yairl/payload-db-check | Only set if you re-publish under a different name (used to build component paths). |
The plugin registers these under your Payload API, all gated by access:
GET /api/db-check/schema — collections, usable key fields, mirror candidatesGET /api/db-check/databases — other databases on the server (rebuild source)GET /api/db-check/missing-versions-count — total documents missing a latest version (sidebar badge)POST /api/db-check/run — run the checksPOST /api/db-check/merge — build a merge plan (dry run) or apply itPOST /api/db-check/repair — bulk merge-identical / clear-broken / backfill-versionsPOST /api/db-check/fix — suggest / apply / rebuild references by nameaccess predicate..dbc-* classes), imported by
the view — no CSS-module or Sass setup required in the host.MIT © Yair Lahav
payload collection references
Cascade-delete or unlink documents that reference a deleted Payload document
5310/wk2v3
payload relationship enhancer
Referential integrity and bi-directional syncing for Payload relationship fields
31901/wk12v2
payloadcms relationships
List incoming and outgoing relationships for any Payload document via a synced relationships collection
101v2
payload dependency graph
Tracks dependencies between collections and globals so you know which content depends on which
032/wk14v2
payload plugin seed
Coverage-first test data seeding for Payload that reads your schema and refuses to run in production
72135/wk0v3
payload locale snapshot
Prevents loss of other-locale translations in localized blocks and arrays when saving with the Postgres adapter
6663/wk3v3