Payload Plugins
Pluginspayload-dev-tools

Reference

Plugin options, environment variables, endpoints, and exports for payload-dev-tools.

For AI / LLMs: View Markdown

Plugin options

enabledbooleandefault NODE_ENV === 'development'

Forces the endpoints on or off regardless of environment. The default gates everything to development. Only force true on a deployment you'd hand a teammate anyway (a preview env): the snapshot exposes collection counts and config details, unauthenticated.

optionsDevToolsOptions

The plugin's own knobs.

devRoutestringdefault '/dev'

Where the host app mounts the createDevPage catch-all. Drives the toolbar's built-in link and the browser redirect from GET /api/dev.

interface DevToolsPluginOptions {
  enabled?: boolean
  options?: {
    devRoute?: string // default '/dev'
  }
}

createDevPage({ payload, tests, enabled }) and <DevToolbar tests links enabled /> take the same enabled override and the same tests array (from defineTest). createDevPage also requires a payload handle (getPayload({ config })); tests and enabled are optional. The toolbar's links adds extra rows to its Pages view; point them at your own labs.

Environment variables

None — everything is gated by the enabled option (which defaults to NODE_ENV === 'development'). The Seed view surfaces the seed plugin's ENABLE_SEED, but that variable belongs to payload-seed, not this plugin.

Endpoints

All four routes 404 outside development. See The /dev pages for the snapshot shape and what each view renders.

RouteWhat
GET /api/devMachine-readable app snapshot (env, plugins, seed status, counts, misses). Browsers are redirected to /dev.
GET /api/dev/stageStages a URL for the toolbar (sets the stage cookie).
GET /api/dev/draftToggles Next.js draft mode.
POST /api/dev/icons/activateSets the active icon set.

Exports

ExportFromWhat
devToolsPlugin@pro-laico/payload-dev-toolsPlugin factory; registers the /api/dev* endpoints.
defineTest@pro-laico/payload-dev-tools (and /next, /toolbar)Identity helper defining a test's versions with full typing.
readDevToolsMarker@pro-laico/payload-dev-toolsReads this plugin's config.custom marker (PayloadDevToolsMarker) — the resolved devRoute, for custom tooling.
DevSnapshot (+ per-plugin types)@pro-laico/payload-dev-toolsThe GET /api/dev response shape, for typed consumers.
STAGE_COOKIE@pro-laico/payload-dev-toolsThe stage cookie name, for custom staging tooling.
createDevPage@pro-laico/payload-dev-tools/nextThe /dev pages; one catch-all drop-in file.
DevToolbar@pro-laico/payload-dev-tools/toolbarThe floating toolbar server component; one line in your layout.
resolveDevChrome@pro-laico/payload-dev-tools/toolbarThe chrome-swap seam: returns the real header/footer, or the toolbar-selected variant.

Collections & globals

None — this plugin registers no collections or globals. It reads sibling plugins' collections through their config.custom markers to build the /dev pages and snapshot.

Next

On this page