rilrom

audit fields

by rilrom
payload-bites
Logging & monitoring
v4
>=4.0.0-beta.10 <5.0.0
MIT

Overview

Summary generated from the README

Adds createdBy and lastModifiedBy audit fields to collections and globals through a Payload plugin configured in the plugins array. This version targets Payload 4 prereleases and is deprecated in favor of core authorship. It exists to ease the upgrade, and while installed it disables core authorship on decorated entities to avoid a duplicate updatedBy field.

Features

  • Adds createdBy and lastModifiedBy fields to collections
  • Applies the same audit fields to globals
  • Supports custom field names through plugin options
  • Sets authorship to false on decorated entities so core does not add a duplicate updatedBy
  • Stores values in the relationTo and value shape that core authorship uses

Use cases

  • Track which user created and last changed each document while upgrading to Payload 4
  • Migrate existing lastModifiedBy data into core updatedBy before removing the plugin

From the author

add createdBy and lastModifiedBy fields to collections and globals

Installation

npm i @payload-bites/audit-fields

115

Stars

7

Forks

2

Open Issues

1 weeks ago

Last Updated

2.3k

Weekly Downloads

v1.8.1

npm Version

43.5 KB

Unpacked Size

0

Dependencies

Repository stars

115+3 since Sep 7

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

Shared by 6 plugins in rilrom/payload-bites.

npm weekly downloads

2.3K+1.2K since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 20262,271
Dec 5, 20262,356
Dec 4, 20262,173
Dec 3, 20261,916
Dec 2, 20261,878
Dec 1, 20262,072
Nov 30, 20262,216
Nov 29, 20262,383
Nov 28, 20262,070
Nov 27, 20262,027
Nov 26, 20262,095
Nov 25, 20262,086
Nov 24, 20262,095
Nov 23, 20261,972
Nov 22, 20261,762
Nov 21, 20261,671
Nov 20, 20261,703
Nov 19, 20261,948
Nov 18, 20262,052
Nov 17, 20261,817
Nov 16, 20262,143
Nov 15, 20262,118
Nov 14, 20262,388
Nov 13, 20262,624
Nov 12, 20262,282
Nov 11, 20262,088
Nov 10, 20262,365
Nov 9, 20261,991
Nov 8, 20262,150
Nov 7, 20262,058
Nov 6, 20261,979
Nov 5, 20261,929
Nov 4, 20262,108
Nov 3, 20261,944
Nov 2, 20262,048
Nov 1, 20262,027
Oct 31, 20262,127
Oct 30, 20262,093
Oct 29, 20261,870
Oct 28, 20261,495
Oct 27, 20261,572
Oct 26, 20261,527
Oct 25, 20261,742
Oct 24, 20261,719
Oct 23, 20261,385
Oct 22, 20261,798
Oct 21, 20262,051
Oct 20, 20262,026
Oct 19, 20262,094
Oct 18, 20261,721
Oct 17, 20261,611
Oct 16, 20261,829
Oct 15, 20261,627
Oct 14, 20261,515
Oct 13, 20261,350
Oct 12, 20261,241
Oct 11, 20261,327
Oct 10, 20261,263
Oct 9, 20261,245
Oct 8, 20261,285
Oct 7, 20261,370
Oct 6, 20261,422
Oct 5, 20261,389
Oct 4, 20261,394
Oct 3, 20261,292
Oct 2, 20261,230
Oct 1, 20261,246
Sep 30, 20261,163
Sep 29, 20261,124
Sep 28, 20261,128
Sep 27, 2026995
Sep 26, 20261,023
Sep 25, 20261,175
Sep 24, 20261,136
Sep 23, 20261,211
Sep 22, 20261,222
Sep 21, 20261,251
Sep 20, 20261,304
Sep 19, 20261,306
Sep 18, 20261,226
Sep 17, 20261,168
Sep 16, 20261,117
Sep 15, 20261,290
Sep 14, 20261,342
Sep 13, 20261,392
Sep 12, 20261,397
Sep 11, 20261,372
Sep 10, 20261,335
Sep 9, 20261,348
Sep 8, 20261,206
Sep 7, 20261,119

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

Health Score

92/100Excellent

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/908347705-audit-fields.svg)](https://payloaddirectory.dev/plugins/908347705-audit-fields)
HTML
<a href="https://payloaddirectory.dev/plugins/908347705-audit-fields"><img src="https://payloaddirectory.dev/badge/908347705-audit-fields.svg" alt="Payload Directory"></a>
Updated Nov 26, 2026Created Dec 25, 2024Published Nov 26, 2026

README

Audit fields

[!WARNING] Deprecated. Payload 4 has built-in authorship, so use that instead. v2.x only exists to ease the upgrade. See Migrating to core authorship.

Add createdBy and lastModifiedBy audit fields to collections and globals.

Compatibility table

Payload versionAudit fields version
v3v1.x
v4v2.x (deprecated)

Payload 4 versions are prereleases. Install them with pnpm add @payload-bites/audit-fields@beta.

Quick start

  1. Install the plugin:
pnpm add @payload-bites/audit-fields
  1. Add the plugin to your payload.config.ts:
/// ....
import { auditFieldsPlugin } from "@payload-bites/audit-fields";

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

Migrating to core authorship

Core authorship stores the same { relationTo, value } shape. createdBy carries over unchanged and lastModifiedBy becomes updatedBy (core also sets updatedBy on create). Use your custom field names if you changed them.

To move over, remove the plugin and run payload migrate:create, then edit the generated migration to copy lastModifiedBy into updatedBy before the old column is dropped.

While installed, v2.x sets authorship: false on everything it decorates (unless you set authorship yourself) so core does not add a duplicate updatedBy field.

Defaults

For defaults, refer to defaults.ts.

Options

For options, refer to types.ts.

Similar plugins