rock-solid

payload lineage

by rock-solid
lineage-kit
Admin customization
v3
^3.0.0
MIT

Overview

Summary generated from the README

Adds two admin pages and a nav link: a lineage graph that traces which collections, globals and blocks feed into others, and a data model ERD with a table per collection and cardinality-labelled relationships. The views are built on the server from the running config and respect admin access plus an optional access function. Requires Payload 3 with Next.js 15 or 16 and React 19.

Features

  • Lineage page tracing upstream and downstream dependencies on hover, with field details on click
  • Data model ERD with tables per collection and global and cardinality labels on reference lines
  • Copy Mermaid output as a flowchart or erDiagram for docs and pull requests
  • Filters for node kinds, unconnected collections and key fields only
  • Options to exclude slugs, restrict access and write the graph to a JSON file
  • Helper functions to build the graph and schema in scripts

Use cases

  • Understand how collections, blocks and globals relate in a large Payload project
  • Keep an up-to-date data model diagram in documentation or tickets
  • Onboard developers by showing which fields link content types together

From the author

Lineage and data model (ERD) pages for the Payload admin: the collections, globals and blocks, and the fields that link them.

Installation

npm i @rocksoliddigital/payload-lineage

0

Stars

0

Forks

2

Open Issues

1 months ago

Last Updated

120

Weekly Downloads

v0.4.0

npm Version

96.2 KB

Unpacked Size

2

Dependencies

GitHub stars

00 since Oct 11

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
Oct 24, 20260
Oct 23, 20260
Oct 22, 20260
Oct 21, 20260
Oct 20, 20260
Oct 19, 20260
Oct 18, 20260
Oct 17, 20260
Oct 16, 20260
Oct 15, 20260
Oct 14, 20260
Oct 13, 20260
Oct 12, 20260
Oct 11, 20260
npm weekly downloads

151−20 since Oct 20

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 2026151
Dec 4, 2026168
Dec 3, 2026205
Dec 2, 2026214
Dec 1, 2026218
Nov 30, 2026218
Nov 29, 2026221
Nov 28, 2026171
Nov 27, 2026239
Nov 26, 2026219
Nov 25, 2026210
Nov 24, 2026208
Nov 23, 2026213
Nov 22, 2026151
Nov 21, 2026191
Nov 20, 2026120
Nov 19, 2026109
Nov 18, 2026167
Nov 17, 2026204
Nov 16, 2026210
Nov 15, 2026227
Nov 14, 2026199
Nov 13, 2026168
Nov 12, 2026162
Nov 11, 2026103
Nov 10, 202670
Nov 9, 202681
Nov 8, 202667
Nov 7, 202679
Nov 6, 2026247
Nov 5, 2026269
Nov 4, 2026269
Nov 3, 2026264
Nov 2, 2026252
Nov 1, 2026249
Oct 31, 2026235
Oct 30, 202692
Oct 29, 202664
Oct 28, 202658
Oct 27, 2026286
Oct 26, 2026447
Oct 25, 2026445
Oct 24, 2026432
Oct 23, 2026400
Oct 22, 2026400
Oct 21, 2026400
Oct 20, 2026171

Each point is npm's rolling 7-day download count.

Health Score

55/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1422791428-payload-lineage.svg)](https://payloaddirectory.dev/plugins/1422791428-payload-lineage)
HTML
<a href="https://payloaddirectory.dev/plugins/1422791428-payload-lineage"><img src="https://payloaddirectory.dev/badge/1422791428-payload-lineage.svg" alt="Payload Directory"></a>
Updated Oct 28, 2026Created Oct 17, 2026Published Oct 28, 2026

README

🧬 @rocksoliddigital/payload-lineage

The content side of lineage, from a Payload config, as two pages in the admin:

  • Lineage (/admin/lineage): collections, globals and blocks, and the fields that link them, read left to right from what each is built from to where it is used: media → block:mediaBlock → pages. Hover a node to trace everything upstream and downstream; click it for the fields behind each link.
  • Data model (/admin/lineage/schema): an ERD, with a table per collection and global listing its fields, and a line from each field that references another collection, labelled with its cardinality:
LabelMeans
many-to-oneOne reference per document, which many documents can share
many-to-manyA list of references: hasMany, or inside an array or blocks field
one-to-oneA unique reference, or a global's single one (a global is one document)
one-to-manyA global's list of references

A "Lineage" link in the nav opens them. To try them, run the example.

Works with Payload 3 on Next.js 15 or 16, with React 19. Early days: what's next is on the roadmap.

✨ Features

👀 Explore

  • Lineage and Data model pages in the admin, with a link in the nav, added by the plugin.
  • Kinds colour the nodes: collections, blocks and globals. Switch any kind on or off, and Hide unconnected collections, like a users that nothing points at.
  • Hover a node to trace its whole lineage: everything upstream and downstream lights up, the rest dims. On the data model, hover a table for what it references and what references it.
  • Click a node or table for the fields behind each link, with its cardinality as a sentence ("Each Post references many Categories"), and Open in the admin.
  • Key fields only cuts the tables down to their ids and references; long tables show ten rows and a "+N more".
  • Copy Mermaid copies what the page shows, with its filters, as a Mermaid diagram: the lineage as a flowchart, the data model as an erDiagram in crow's-foot notation. Paste it into a PR, a doc or a ticket, and GitHub, GitLab and most docs tools draw it.

🔒 Access

  • For users who can use the admin and pass the plugin's access, showing only the collections and globals they can read. Everything is checked and built on the server. See Access.

🧩 Setup

  • One line in payload.config.ts. Options for excluded slugs, access and the JSON file.
  • Built from the running config on each visit (well under a millisecond), so the pages are never out of date. buildContentGraph and buildSchema give the same data to scripts.
  • Follows the admin's light and dark themes.

📥 Install

pnpm add @rocksoliddigital/payload-lineage

⚙️ Set up

Add the plugin to payload.config.ts:

import { lineagePlugin } from '@rocksoliddigital/payload-lineage';

export default buildConfig({
  // ...
  plugins: [lineagePlugin()],
});

Then update the import map, so the admin can find the pages. next dev does this on its own; for a build, run:

pnpm payload generate:importmap
OptionDefault
adminViewtrueThe two admin pages and the nav link
accessnone({ user, payload }) => boolean, on top of admin access; see Access
outputFilenoneWhere to write the lineage graph as JSON on each start, outside production only
exclude[]Slugs to leave out of both pages and the file; block:text names only that block
enabledtrueSet to false to turn the plugin off

Payload's own collections (payload-preferences, payload-migrations, ...) are always left out. If the file can't be written (e.g. a read-only filesystem), Payload logs a warning and starts anyway.

To leave out form-builder's field blocks, which crowd the lineage graph:

lineagePlugin({
  exclude: [
    'checkbox',
    'country',
    'email',
    'message',
    'number',
    'select',
    'state',
    'text',
    'textarea',
  ].map((s) => `block:${s}`),
});

Or build either yourself, e.g. in a script, and keep a diagram in your docs up to date:

import {
  buildContentGraph,
  buildSchema,
  contentGraphToMermaid,
  schemaToMermaid,
} from '@rocksoliddigital/payload-lineage';
import config from '@payload-config';

const graph = buildContentGraph(await config);
const schema = buildSchema(await config);
const diagram = schemaToMermaid(schema); // or contentGraphToMermaid(graph)

🔒 Access

The pages and their nav link are for users who can use the admin (Payload's access.admin on the users collection, which Payload itself doesn't check on custom pages), and who pass the plugin's access, if set:

lineagePlugin({ access: ({ user }) => user.role === 'admin' });

Anyone else is sent where Payload sends them for its own pages: the login page when logged out, the unauthorized page when logged in, each with a redirect back. The pages show only the collections and globals the user can read, along with every link to or from them; blocks have no access control of their own, so they're all shown. Everything is checked and built on the server, so nothing a user can't see reaches the browser.

📄 The lineage file

{
  "nodes": [
    { "id": "collection:media", "kind": "collection", "slug": "media", "label": "Media" },
    { "id": "block:mediaBlock", "kind": "block", "slug": "mediaBlock", "label": "Media Block" }
  ],
  "edges": [
    {
      "source": "collection:media",
      "target": "block:mediaBlock",
      "kind": "upload",
      "fields": ["media"]
    }
  ]
}

Node ids are <kind>:<slug>, so they can't clash with the file paths the Storybook addon uses as ids. source is the dependency and target what uses it, as in the Storybook addon. Join fields are left out, since each is the reverse of a relationship that is already an edge. A collection that links to itself, like nested-docs' parent, keeps the edge to itself.

🗂️ The data model

buildSchema flattens groups, rows, collapsibles and tabs into dotted rows (hero.media), and keeps each array and blocks field as one row (gallery[], layout). A reference inside one of those attaches to that row, with its full path: layout[mediaBlock].media. Hidden fields (an auth collection's salt and hash) and UI fields are left out. A join field is a row but not a line, since it reverses a relationship that already is one.

Similar plugins