Skip to content

Production Guides & Recipes

OptionDefaultBehavior
persiantruePersian admin defaults; set false to disable.
loggertrueBridge SDK options when config.logger is unset; set false to disable.
afterCommittrueInstalls afterCommitPlugin() from @nexload-sdk/payload-hooks; set false to disable.
fields{}Options for payloadFieldsPlugin; set false to disable.
audit{}Options for auditPlugin; set false to disable.

The preset returns its plugins in this order: Persian, logger bridge, after-commit, fields, audit. payloadFieldsPlugin runs at order 900 and auditPlugin at 1000. Ordinary host plugins run first, so their collections are available to both. The preset does not add, remove, or change collection fields. Define them with Payload Schema and Payload Fields.

The Persian plugin preserves host languages, fallback language, and default timezone. It adds Persian translations if absent, defaults the fallback to fa, and adds Asia/Tehran to supported timezones. It sets RTL only on existing fa locale objects without an explicit RTL value. It never creates localization or adds locales.

Call configureLogger() before buildConfig(). When config.logger is unset, the plugin uses the options form from getPayloadLoggerConfig(); Payload creates its own Pino logger from those options. Payload writes JSON in development unless configureLogger({ destination }) supplies a stream. Rebuild the Payload config after forced SDK reconfiguration. See the logger API.

With afterCommit enabled (the default), three things work on the exact commit of each database transaction:

  • auditPlugin writes payload.document.created, payload.document.updated and payload.document.deleted after the commit. A write that rolls back produces no entry.
  • @nexload-sdk/payload-revalidate sends each batch on commit, with no polling and no 5-second cap.
  • Your own hooks can call runAfterCommit(req, key, fn) from @nexload-sdk/payload-hooks.

Set afterCommit: false to go back to immediate audit entries and the revalidate polling fallback. Callbacks live in process memory: an entry or a callback is lost if the process stops between the commit and the callback.

Audit reads are off by default; auth is on. The implicit default users collection is created after plugins run and is not audited: declare it explicitly. Read and auth entries are always written immediately. Write entries are written after commit unless afterCommit is false, in which case they are emitted before the commit and may describe rolled-back changes. See Payload Hooks for options and events.

The getPayloadLoggerConfig() bridge maps the SDK success threshold to Payload warn. Payload’s logger has no success() method.