Adds read-only createdBy and lastModifiedBy relationship fields to collections and globals, set automatically from the acting user. Replaces the versions list view with a recreation that adds a per-version Modified By column. Requires Payload 3.27 or later and regenerating the import map.
Payload plugin that tracks who created and last modified every document, with an enhanced versions view showing who modified each version.
Installation
npm i @whatworks/payload-audit-fields16
Stars
1
Forks
2
Open Issues
3 days ago
Last Updated
176
Weekly Downloads
v0.2.0
npm Version
141.2 KB
Unpacked Size
0
Dependencies
16+1 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 16 |
| Dec 5, 2026 | 16 |
| Dec 4, 2026 | 16 |
| Dec 3, 2026 | 16 |
| Dec 2, 2026 | 16 |
| Dec 1, 2026 | 16 |
| Nov 30, 2026 | 16 |
| Nov 29, 2026 | 16 |
| Nov 28, 2026 | 16 |
| Nov 27, 2026 | 16 |
| Nov 26, 2026 | 16 |
| Nov 25, 2026 | 16 |
| Nov 24, 2026 | 16 |
| Nov 23, 2026 | 16 |
| Nov 22, 2026 | 16 |
| Nov 21, 2026 | 16 |
| Nov 20, 2026 | 16 |
| Nov 19, 2026 | 16 |
| Nov 18, 2026 | 16 |
| Nov 17, 2026 | 15 |
| Nov 16, 2026 | 15 |
| Nov 15, 2026 | 15 |
| Nov 14, 2026 | 15 |
| Nov 13, 2026 | 15 |
| Nov 12, 2026 | 15 |
| Nov 11, 2026 | 15 |
| Nov 10, 2026 | 15 |
| Nov 9, 2026 | 15 |
| Nov 8, 2026 | 15 |
| Nov 7, 2026 | 15 |
| Nov 6, 2026 | 15 |
| Nov 5, 2026 | 15 |
| Nov 4, 2026 | 15 |
| Nov 3, 2026 | 15 |
| Nov 2, 2026 | 15 |
| Nov 1, 2026 | 15 |
| Oct 31, 2026 | 15 |
| Oct 30, 2026 | 15 |
| Oct 29, 2026 | 15 |
| Oct 28, 2026 | 15 |
| Oct 27, 2026 | 15 |
| Oct 26, 2026 | 15 |
| Oct 25, 2026 | 15 |
| Oct 24, 2026 | 15 |
| Oct 23, 2026 | 15 |
| Oct 22, 2026 | 15 |
| Oct 21, 2026 | 15 |
| Oct 20, 2026 | 15 |
| Oct 19, 2026 | 15 |
| Oct 18, 2026 | 15 |
| Oct 17, 2026 | 15 |
| Oct 16, 2026 | 15 |
| Oct 15, 2026 | 15 |
| Oct 14, 2026 | 15 |
| Oct 13, 2026 | 15 |
| Oct 12, 2026 | 15 |
| Oct 11, 2026 | 15 |
| Oct 10, 2026 | 15 |
| Oct 9, 2026 | 15 |
| Oct 8, 2026 | 15 |
| Oct 7, 2026 | 15 |
| Oct 6, 2026 | 15 |
| Oct 5, 2026 | 15 |
| Oct 4, 2026 | 15 |
| Oct 3, 2026 | 15 |
| Oct 2, 2026 | 15 |
| Oct 1, 2026 | 15 |
| Sep 30, 2026 | 15 |
| Sep 29, 2026 | 15 |
| Sep 28, 2026 | 15 |
| Sep 27, 2026 | 15 |
| Sep 26, 2026 | 15 |
| Sep 25, 2026 | 15 |
| Sep 24, 2026 | 15 |
| Sep 23, 2026 | 15 |
| Sep 22, 2026 | 15 |
| Sep 21, 2026 | 15 |
| Sep 20, 2026 | 15 |
| Sep 19, 2026 | 15 |
| Sep 18, 2026 | 15 |
| Sep 17, 2026 | 15 |
| Sep 16, 2026 | 15 |
| Sep 15, 2026 | 15 |
| Sep 14, 2026 | 15 |
| Sep 13, 2026 | 15 |
| Sep 12, 2026 | 15 |
| Sep 11, 2026 | 15 |
| Sep 10, 2026 | 15 |
| Sep 9, 2026 | 15 |
| Sep 8, 2026 | 15 |
| Sep 7, 2026 | 15 |
Shared by 12 plugins in what-works-global/payload-packages.
217+202 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 217 |
| Dec 5, 2026 | 263 |
| Dec 4, 2026 | 297 |
| Dec 3, 2026 | 266 |
| Dec 2, 2026 | 271 |
| Dec 1, 2026 | 300 |
| Nov 30, 2026 | 297 |
| Nov 29, 2026 | 254 |
| Nov 28, 2026 | 201 |
| Nov 27, 2026 | 157 |
| Nov 26, 2026 | 161 |
| Nov 25, 2026 | 176 |
| Nov 24, 2026 | 190 |
| Nov 23, 2026 | 190 |
| Nov 22, 2026 | 218 |
| Nov 21, 2026 | 224 |
| Nov 20, 2026 | 310 |
| Nov 19, 2026 | 277 |
| Nov 18, 2026 | 343 |
| Nov 17, 2026 | 302 |
| Nov 16, 2026 | 311 |
| Nov 15, 2026 | 318 |
| Nov 14, 2026 | 347 |
| Nov 13, 2026 | 299 |
| Nov 12, 2026 | 292 |
| Nov 11, 2026 | 247 |
| Nov 10, 2026 | 278 |
| Nov 9, 2026 | 279 |
| Nov 8, 2026 | 257 |
| Nov 7, 2026 | 232 |
| Nov 6, 2026 | 200 |
| Nov 5, 2026 | 200 |
| Nov 4, 2026 | 193 |
| Nov 3, 2026 | 167 |
| Nov 2, 2026 | 157 |
| Nov 1, 2026 | 142 |
| Oct 31, 2026 | 124 |
| Oct 30, 2026 | 117 |
| Oct 29, 2026 | 89 |
| Oct 28, 2026 | 23 |
| Oct 27, 2026 | 20 |
| Oct 26, 2026 | 23 |
| Oct 25, 2026 | 28 |
| Oct 24, 2026 | 28 |
| Oct 23, 2026 | 20 |
| Oct 22, 2026 | 34 |
| Oct 21, 2026 | 42 |
| Oct 20, 2026 | 37 |
| Oct 19, 2026 | 34 |
| Oct 18, 2026 | 39 |
| Oct 17, 2026 | 73 |
| Oct 16, 2026 | 73 |
| Oct 15, 2026 | 62 |
| Oct 14, 2026 | 64 |
| Oct 13, 2026 | 63 |
| Oct 12, 2026 | 62 |
| Oct 11, 2026 | 75 |
| Oct 10, 2026 | 47 |
| Oct 9, 2026 | 65 |
| Oct 8, 2026 | 65 |
| Oct 7, 2026 | 60 |
| Oct 6, 2026 | 64 |
| Oct 5, 2026 | 64 |
| Oct 4, 2026 | 39 |
| Oct 3, 2026 | 41 |
| Oct 2, 2026 | 23 |
| Oct 1, 2026 | 33 |
| Sep 30, 2026 | 30 |
| Sep 29, 2026 | 26 |
| Sep 28, 2026 | 26 |
| Sep 27, 2026 | 28 |
| Sep 26, 2026 | 22 |
| Sep 25, 2026 | 24 |
| Sep 24, 2026 | 16 |
| Sep 23, 2026 | 27 |
| Sep 22, 2026 | 29 |
| Sep 21, 2026 | 32 |
| Sep 20, 2026 | 32 |
| Sep 19, 2026 | 32 |
| Sep 18, 2026 | 32 |
| Sep 17, 2026 | 28 |
| Sep 16, 2026 | 16 |
| Sep 15, 2026 | 14 |
| Sep 14, 2026 | 11 |
| Sep 13, 2026 | 9 |
| Sep 12, 2026 | 7 |
| Sep 11, 2026 | 7 |
| Sep 10, 2026 | 11 |
| Sep 9, 2026 | 12 |
| Sep 8, 2026 | 13 |
| Sep 7, 2026 | 15 |
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/1064440892-audit-fields)<a href="https://payloaddirectory.dev/plugins/1064440892-audit-fields"><img src="https://payloaddirectory.dev/badge/1064440892-audit-fields.svg" alt="Payload Directory"></a>README
Payload plugin that records who created and who last modified every document, and upgrades the versions list view with a Modified By column so you can see exactly who saved each version.
createdBy / lastModifiedBy relationship fields to every collection and global by default (opt-out, not opt-in).resolveUserLabel) — on the document, in the collection list view, and in the versions view — linked to the user document.@payload-bites/audit-fields — same default field names and the same stored value shape ({ relationTo, value }), so you can switch plugins without a migration.


pnpm add @whatworks/payload-audit-fields
import { auditFieldsPlugin } from '@whatworks/payload-audit-fields'
import { buildConfig } from 'payload'
export default buildConfig({
// ...
plugins: [
// Register last so collections added by other plugins are audited too.
auditFieldsPlugin(),
],
})
Then regenerate the import map so the admin panel can resolve the plugin's components:
payload generate:importmap
That's it — every collection and global now tracks createdBy and lastModifiedBy, and every entity with versions enabled gets the enhanced versions view.
auditFieldsPlugin({
// Which collections to audit. Defaults to all.
// - true — every collection (default)
// - ['posts', 'pages'] — only these
// - { exclude: ['tags'] } — all except these
collections: { exclude: ['tags'] },
// Which globals to audit. Same semantics. Defaults to all.
globals: true,
// Auth collections users can be attributed to.
// Defaults to every auth-enabled collection in your config.
userCollections: ['users'],
fields: {
createdBy: {
name: 'createdBy',
label: 'Created By', // string | { [locale]: string } | (slug) => label
// Escape hatch for full control over the generated field, e.g. delete
// `field.admin.components` to restore the default relationship input:
override: (field) => ({ ...field, index: true }),
},
// Set to false to only track one of the two fields:
lastModifiedBy: { name: 'lastModifiedBy', label: 'Last Modified By' },
},
showInSidebar: false, // default false — fields render at the end of the main field area
index: false, // default false — add a DB index to the fields
// Custom attribution, e.g. attribute job/webhook writes to a bot user.
// Return null/undefined to leave the fields untouched for that change.
resolveUser: ({ req }) =>
req.user ? { relationTo: req.user.collection, value: req.user.id } : null,
// How attributed users are displayed — on the document and in the versions
// view. May be async. Defaults to email → username → ID.
resolveUserLabel: ({ user }) =>
user.firstName ? `${user.firstName} ${user.lastName}` : (user.email as string),
// The enhanced versions list view. Default: true.
versionsView: {
columnLabel: 'Modified By', // string | { [locale]: string }
},
// ...or `versionsView: false` to keep Payload's default view.
})
createdBy and lastModifiedBy to the acting user.lastModifiedBy and strips any incoming createdBy value, so API clients cannot rewrite attribution after the fact.user/req) leave both fields untouched, so scripts can set them explicitly when needed — or use resolveUser to attribute them to a dedicated system user.payload-preferences, payload-migrations, payload-locked-documents, payload-folders, …) — they are created after plugins run, are system-managed, or already carry their own user reference.On the document, audit fields render as a read-only label linking to the user document instead of the default (greyed-out) relationship input. The collection list view shows the same label in place of the raw relationship ID, and the versions view's "Modified By" column shows it too.
All three use resolveUserLabel to derive the label from the user document, which
is fetched with the viewing user's access rights — if the current user cannot
read the users collection, the raw ID is shown instead. The default resolver
returns user.email, falling back to user.username, then the ID.
resolveUserLabel may be async, so you can derive the label from anywhere:
resolveUserLabel: async ({ relationTo, req, user }) => {
const profile = await req.payload.findByID({ collection: 'profiles', id: user.profile })
return profile?.displayName ?? (user.email as string)
}
For every audited entity with versions enabled, the plugin sets
admin.components.views.edit.versions to its own server view
(@whatworks/payload-audit-fields/rsc#AuditVersionsView) — unless you have already
customized that view, in which case yours wins.
The view is a faithful recreation of Payload's built-in versions list (same layout,
pagination, status pills, autosave badges, and trash support), with one addition: a
Modified By column showing who saved each version, linked to the user document.
It reads lastModifiedBy from each version snapshot and falls back to createdBy
for the initial version.
The vendored view internals come from [email protected] and degrade gracefully on
the older Payload versions in the peer range (version-gated props are simply
absent there); if Payload materially changes its versions view, update the
vendored files alongside the peer bump.
Field names, labels, and the stored value shape are identical by default, so swapping plugins requires no data migration. Differences to be aware of:
lastModifiedBy is now also set on create (previously only on update).createdBy can no longer be overwritten through authenticated API updates.showInSidebar: true for the old placement.resolveUserLabel, or restore the input via
fields.createdBy.override).excludedCollections / excludedGlobals become collections: { exclude: [...] }
/ globals: { exclude: [...] }.req.user.collection, so users from any auth collection are
recorded correctly (previously always the admin user collection).activity log
Chronological activity feed of document changes and user logins with links to affected documents and versions
62185/wk16v3
payload plugin audit
Audit trail for Payload collections that records who created or updated documents and stores update deltas
6134/wk1v3
authors info
Automatically record who created, edited and published documents across collections and globals
59277/wk183v3
payload plugin author fields
Adds createdBy and updatedBy fields to all collections and globals in a Payload app
3676/wk43v1 v2
audit fields
Adds createdBy and lastModifiedBy fields to Payload collections and globals
922.3k/wk115v4
activity log
Record create, update and delete activity on selected collections and globals in a dedicated log collection
87639/wk115v4