Dry Run

Test Payload create operations end-to-end without persisting, by rolling back the transaction after hooks and validation run.

Community 0 197/wk MIT v1.0.1

Installation

pnpm add @lizardglobal/payload-dry-run

About

Payload Dry Run lets you exercise a collection's `create` operation all the way through validation, hooks, and access control, then throws the write away. The full pipeline runs as if the document were being committed, so anything that would reject or transform the request still fires. Only the final database commit is undone, via `req.payload.db.rollbackTransaction(req.transactionID)` inside an `afterOperation` hook. You enable it per collection with `dryRunCreatePlugin({ collections: ['users', 'orders'] })`. A dry run is triggered by passing a truthy flag (default `_dryRun`) through the query string, request body, search params, or `req.context`. Truthy values include `true`, `1`, `"on"`, `"yes"`, and `"true"`, case-insensitive. The flag is also written back into `req.context` so downstream hooks can detect it. The `dryRunFieldName` option accepts a single shared name, a per-collection object, or an object with a `_default` fallback. For auth collections with email verification, a `beforeOperation` hook sets `disableVerificationEmail: true` so a dry run does not send verification mail. A `disabled` flag skips the plugin entirely, useful for keeping it off in production. A `withCreateDryRun(collection, fieldName?)` helper applies the same behavior to a single `CollectionConfig` without going through the plugin, for cases where you compose collection configs manually. The helper is idempotent. If a rollback is needed but no `transactionID` is present, the plugin throws rather than silently leaving a committed document. The project marks itself experimental, with APIs and schema still subject to change.

Package info

Package name
@lizardglobal/payload-dry-run
Latest version
1.0.1
Unpacked size
35 kB
License
MIT
Weekly downloads
197
Last publish
Jul 28, 2026

More from LizardGlobalGH

View profile

Similar plugins

More in Devtools