Attaches revalidation hooks to every collection and global so a change busts only the cache tags it affects. It also provides finders for use inside 'use cache' getters that fetch and tag in one call. Requires Payload 3, React 19, and Next.js 16+ with Cache Components enabled on the App Router.
Surgical Next.js cache revalidation for Payload CMS: auto-attached hooks that bust exactly the tags a change touches, cached finders that fetch AND tag in one call inside 'use cache' getters, and a dependency map showing what revalidates when.
Installation
npm i @pro-laico/payload-revalidate18
Stars
1
Forks
1
Open Issues
3 months ago
Last Updated
236
Weekly Downloads
v0.8.5
npm Version
349.3 KB
Unpacked Size
1
Dependencies
18+2 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 18 |
| Dec 5, 2026 | 18 |
| Dec 4, 2026 | 18 |
| Dec 3, 2026 | 18 |
| Dec 2, 2026 | 18 |
| Dec 1, 2026 | 18 |
| Nov 30, 2026 | 18 |
| Nov 29, 2026 | 18 |
| Nov 28, 2026 | 18 |
| Nov 27, 2026 | 19 |
| Nov 26, 2026 | 19 |
| Nov 25, 2026 | 19 |
| Nov 24, 2026 | 19 |
| Nov 23, 2026 | 19 |
| Nov 22, 2026 | 19 |
| Nov 21, 2026 | 19 |
| Nov 20, 2026 | 19 |
| Nov 19, 2026 | 19 |
| Nov 18, 2026 | 19 |
| Nov 17, 2026 | 18 |
| Nov 16, 2026 | 18 |
| Nov 15, 2026 | 18 |
| Nov 14, 2026 | 18 |
| Nov 13, 2026 | 18 |
| Nov 12, 2026 | 18 |
| Nov 11, 2026 | 18 |
| Nov 10, 2026 | 18 |
| Nov 9, 2026 | 18 |
| Nov 8, 2026 | 18 |
| Nov 7, 2026 | 18 |
| Nov 6, 2026 | 18 |
| Nov 5, 2026 | 18 |
| Nov 4, 2026 | 18 |
| Nov 3, 2026 | 18 |
| Nov 2, 2026 | 18 |
| Nov 1, 2026 | 18 |
| Oct 31, 2026 | 18 |
| Oct 30, 2026 | 18 |
| Oct 29, 2026 | 18 |
| Oct 28, 2026 | 18 |
| Oct 27, 2026 | 18 |
| Oct 26, 2026 | 18 |
| Oct 25, 2026 | 18 |
| Oct 24, 2026 | 18 |
| Oct 23, 2026 | 18 |
| Oct 22, 2026 | 18 |
| Oct 21, 2026 | 17 |
| Oct 20, 2026 | 17 |
| Oct 19, 2026 | 17 |
| Oct 18, 2026 | 17 |
| Oct 17, 2026 | 17 |
| Oct 16, 2026 | 17 |
| Oct 15, 2026 | 17 |
| Oct 14, 2026 | 17 |
| Oct 13, 2026 | 17 |
| Oct 12, 2026 | 17 |
| Oct 11, 2026 | 17 |
| Oct 10, 2026 | 17 |
| Oct 9, 2026 | 17 |
| Oct 8, 2026 | 17 |
| Oct 7, 2026 | 17 |
| Oct 6, 2026 | 17 |
| Oct 5, 2026 | 17 |
| Oct 4, 2026 | 17 |
| Oct 3, 2026 | 17 |
| Oct 2, 2026 | 16 |
| Oct 1, 2026 | 16 |
| Sep 30, 2026 | 16 |
| Sep 29, 2026 | 16 |
| Sep 28, 2026 | 16 |
| Sep 27, 2026 | 16 |
| Sep 26, 2026 | 16 |
| Sep 25, 2026 | 16 |
| Sep 24, 2026 | 16 |
| Sep 23, 2026 | 16 |
| Sep 22, 2026 | 16 |
| Sep 21, 2026 | 16 |
| Sep 20, 2026 | 16 |
| Sep 19, 2026 | 16 |
| Sep 18, 2026 | 16 |
| Sep 17, 2026 | 16 |
| Sep 16, 2026 | 16 |
| Sep 15, 2026 | 16 |
| Sep 14, 2026 | 16 |
| Sep 13, 2026 | 16 |
| Sep 12, 2026 | 16 |
| Sep 11, 2026 | 16 |
| Sep 10, 2026 | 16 |
| Sep 9, 2026 | 16 |
| Sep 8, 2026 | 16 |
| Sep 7, 2026 | 16 |
Shared by 7 plugins in pro-laico/payload-plugins.
236+210 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 236 |
| Dec 5, 2026 | 210 |
| Dec 4, 2026 | 202 |
| Dec 3, 2026 | 231 |
| Dec 2, 2026 | 187 |
| Dec 1, 2026 | 232 |
| Nov 30, 2026 | 282 |
| Nov 29, 2026 | 347 |
| Nov 28, 2026 | 506 |
| Nov 27, 2026 | 531 |
| Nov 26, 2026 | 525 |
| Nov 25, 2026 | 486 |
| Nov 24, 2026 | 440 |
| Nov 23, 2026 | 388 |
| Nov 22, 2026 | 331 |
| Nov 21, 2026 | 181 |
| Nov 20, 2026 | 171 |
| Nov 19, 2026 | 128 |
| Nov 18, 2026 | 126 |
| Nov 17, 2026 | 121 |
| Nov 16, 2026 | 126 |
| Nov 15, 2026 | 125 |
| Nov 14, 2026 | 116 |
| Nov 13, 2026 | 99 |
| Nov 12, 2026 | 112 |
| Nov 11, 2026 | 116 |
| Nov 10, 2026 | 127 |
| Nov 9, 2026 | 158 |
| Nov 8, 2026 | 219 |
| Nov 7, 2026 | 265 |
| Nov 6, 2026 | 305 |
| Nov 5, 2026 | 349 |
| Nov 4, 2026 | 365 |
| Nov 3, 2026 | 384 |
| Nov 2, 2026 | 379 |
| Nov 1, 2026 | 323 |
| Oct 31, 2026 | 285 |
| Oct 30, 2026 | 239 |
| Oct 29, 2026 | 152 |
| Oct 28, 2026 | 113 |
| Oct 27, 2026 | 79 |
| Oct 26, 2026 | 140 |
| Oct 25, 2026 | 169 |
| Oct 24, 2026 | 223 |
| Oct 23, 2026 | 215 |
| Oct 22, 2026 | 343 |
| Oct 21, 2026 | 445 |
| Oct 20, 2026 | 465 |
| Oct 19, 2026 | 387 |
| Oct 18, 2026 | 374 |
| Oct 17, 2026 | 582 |
| Oct 16, 2026 | 981 |
| Oct 15, 2026 | 900 |
| Oct 14, 2026 | 802 |
| Oct 13, 2026 | 785 |
| Oct 12, 2026 | 773 |
| Oct 11, 2026 | 752 |
| Oct 10, 2026 | 475 |
| Oct 9, 2026 | 82 |
| Oct 8, 2026 | 51 |
| Oct 7, 2026 | 49 |
| Oct 6, 2026 | 53 |
| Oct 5, 2026 | 51 |
| Oct 4, 2026 | 68 |
| Oct 3, 2026 | 72 |
| Oct 2, 2026 | 80 |
| Oct 1, 2026 | 77 |
| Sep 30, 2026 | 87 |
| Sep 29, 2026 | 85 |
| Sep 28, 2026 | 84 |
| Sep 27, 2026 | 56 |
| Sep 26, 2026 | 97 |
| Sep 25, 2026 | 153 |
| Sep 24, 2026 | 175 |
| Sep 23, 2026 | 181 |
| Sep 22, 2026 | 173 |
| Sep 21, 2026 | 200 |
| Sep 20, 2026 | 206 |
| Sep 19, 2026 | 163 |
| Sep 18, 2026 | 95 |
| Sep 17, 2026 | 64 |
| Sep 16, 2026 | 52 |
| Sep 15, 2026 | 93 |
| Sep 14, 2026 | 91 |
| Sep 13, 2026 | 86 |
| Sep 12, 2026 | 81 |
| Sep 11, 2026 | 79 |
| Sep 10, 2026 | 80 |
| Sep 9, 2026 | 75 |
| Sep 8, 2026 | 50 |
| Sep 7, 2026 | 26 |
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/1281664108-payload-revalidate)<a href="https://payloaddirectory.dev/plugins/1281664108-payload-revalidate"><img src="https://payloaddirectory.dev/badge/1281664108-payload-revalidate.svg" alt="Payload Directory"></a>README
Atomic Next.js cache revalidation for Payload CMS (App Router, Cache Components): id-keyed cache entries, field-driven busts that touch exactly what a change means, and a live dependency map showing what revalidates when.
Requires Payload ^3, React 19, and Next.js 16+ with Cache Components on the App Router. It's a Next cache tool — there is no non-Next mode. Set cacheComponents: true in next.config.
revalidatePlugin() hooks every collection/global; doc
tags always, scoped list tags only when a scope's declared fields (or membership)
change, draft saves only the draft lane, context.disableRevalidate honored.join field is a live query, not a stable reference, so
create/delete/reassign of a member surgically busts only the affected parent's membership
({child}:join:{on}:{parentId}) — the parent whose "all my posts" list actually moved,
never the others.'use cache' getters, one finder call fetches AND
tags: findDoc / findDocByID (one doc = one entry, id-keyed, shared by every usage
site), findIds (lists cache ids only — select: {} forced — with declared scopes
like posts:list:featured), findGlobal. Atomic defaults baked in (depth: 0,
errors → null), full local-API passthrough, returns typed
from your generated payload-types, and user/req refused (a shared cache entry
must not hold a requester-scoped read). Access is left to Payload's own default
(overrideAccess: true) — pass overrideAccess: false to scope a read to what an
anonymous visitor may see. References stay ids — "edit image 123 → only
its own entry re-materializes, everywhere it's used." The low-level cacheDoc /
cacheIds / cacheGlobal primitives stay exported for getters the finders can't
express.GET /api/revalidate-map, rendered by @pro-laico/payload-dev-tools at
/dev/revalidate, or dumped as a Markdown doc with payload revalidate-map.@pro-laico/payload-seed run.// payload.config.ts — add it LAST so plugin-contributed collections get hooks too
plugins: [seedPlugin(), revalidatePlugin()]
// lib/cache.ts — seed the read helpers ONCE with your app's live Payload session
import config from '@payload-config'
import { createCacheHelpers } from '@pro-laico/payload-revalidate/cache'
import { getPayload } from 'payload'
export const { findDoc, findDocByID, findIds, findGlobal } = createCacheHelpers(getPayload({ config }))
// getters — 'use cache' + one finder call each
import { findDoc, findIds } from '@/lib/cache'
export async function getPost(slug: string) {
'use cache'
return findDoc('posts', { where: { slug: { equals: slug } }, as: slug })
}
export async function getRecentPostIds() {
'use cache'
return (await findIds('posts', { sort: '-publishedAt', limit: 12, list: 'recent' })).ids
}
The package never resolves Payload or your config itself — no globalThis stashes, no
@payload-config alias tricks, no transpilePackages requirement. The handle you seed is
the session that tags every read.
The plugin registers a payload revalidate-map command (Payload custom bin — no package
path, no runner script). It prints the project's cache dependency map — tag vocabulary,
per-collection blast radius, the full reference graph — as a Markdown doc straight from the
config, no server booted. Handy for a REVALIDATION.md in the repo, or as context for an AI
working in the project.
payload revalidate-map > REVALIDATION.md
payload revalidate-map --json --out revalidate-map.json # raw inspection JSON
It reads config.custom.payloadRevalidate.options, so the output reflects the app's real
prefix, opt-outs, and rules. Programmatic equivalent: renderRevalidateMap(buildStaticInspection(config)).
Documentation → ·
Example app: examples/revalidate-sandbox
MIT — not affiliated with Payload CMS.
cached local api
Cache Payload Local API operations with Next.js unstable_cache and automatic tag-based revalidation
48112/wk335v3
payloadcms redis cache
Redis client helper for caching Payload collection data in Next.js apps
3813/wk2v?
payload upstash
Upstash Redis key-value adapter for Payload's built-in KV store
82333/wk7v3 v4
payload kv
Store counters, feeds and expiring data in Redis or KV stores while querying them as normal Payload fields
771.4k/wk0v3 v4
payload cache
Automatic Next.js 16 and Vercel cache tagging and invalidation for Payload reads
74321/wk0v3 v4
payload redis cache
Redis-backed cache layer for Payload API endpoints, keyed by user collection and request URL
48271/wk64v1