# payloadcms/payload — codebase unpack

> Canonical page: https://codevetter.com/unpack/payload

This is a deterministic Repo Unpack scan of payloadcms/payload — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2 (2026-10-02)
- Last upstream commit: feat!: add database copy method (#18453)
- Generated by codevetter 1.15.0 on 2026-10-02
- 4000 files scanned · 13.2 MB

Source inspection; upstream code and tests were not executed.

## Languages

- TypeScript: 7362 files
- JSON: 471 files
- CSS: 457 files
- Markdown: 326 files
- JavaScript: 200 files
- Sass: 136 files
- YAML: 66 files
- Shell: 17 files

## Repository structure

- packages/ — 928 files
- test/ — 927 files
- templates/ — 927 files
- examples/ — 774 files
- docs/ — 174 files
- .github/ — 108 files
- tools/ — 62 files
- scripts/ — 13 files

Probable source entrypoint: `packages/` (inferred from the tree, not upstream docs)

## Source layout — app/

- app/(app)/ — 2 files
- app/(payload)/ — 8 files
- app/my-route/ — 1 file
- app/global-error.tsx — 1 file

## Package

- package.json: payload-monorepo v4.0.0-canary.37 — 74 declared dependencies

## Structural health signals

Average score 6.3/10 across 96 files; 54 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- e6cd442f4056 (2026-10-02) feat!: add database copy method (#18453)
- 401d1d87ede9 (2026-10-02) feat: add database batch processing foundation (#18455)
- cfad46020ff8 (2026-10-02) feat: export batchProcessing utility (#18454)
- b753f9ef1176 (2026-10-02) test: fail fast on e2e server crash, fix throttle leak, drop 1s fixture delays (#18444)
- d5ba54edeadc (2026-10-02) fix: memory leak on version and draft operations with mongodb (#18445)

## Overview

Payload is a configurable CMS and application backend for developers who want typed content models, an editor-facing React admin interface, and REST, GraphQL, and server-side APIs over the same data. Its configuration drives collections, globals, fields, authorization, hooks, and integrations; database and file-storage adapters separate application behavior from persistence. This brief examines commit e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2, whose manifest identifies version 4.0.0-canary.37 and whose admin implementation includes shared framework boundaries beyond Next.js.

## System map

The configuration and core Payload instance form the backend center of the system. Framework adapters expose that backend through HTTP handlers and server-rendered admin entrypoints, while shared UI code owns much of the admin implementation. Persistence is adapter-specific, with separate database, KV, email, and file-storage boundaries. The inspected workspace is a canary monorepo, so versioned source takes precedence over older architectural descriptions.
- The root is a private ESM monorepo at 4.0.0-canary.37; pnpm-workspace.yaml includes packages, tools, the test workspace, and four template workspaces, with pnpm 11.9.0 pinned. — [package.json#L1-9](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L1-L9) [package.json#L226-227](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L226-L227) [pnpm-workspace.yaml#L1-8](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/pnpm-workspace.yaml#L1-L8)
- Generated Next.js app wiring delegates REST verbs to @payloadcms/next/routes, admin pages to RootPage, and server functions plus layout rendering to @payloadcms/next/layouts. — [app/(payload)/api/[...slug]/route.ts#L1-9](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/app/(payload)/api/%5B...slug%5D/route.ts#L1-L9) [app/(payload)/admin/[[...segments]]/page.tsx#L18-24](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/app/(payload)/admin/%5B%5B...segments%5D%5D/page.tsx#L18-L24) [app/(payload)/layout.tsx#L22-35](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/app/(payload)/layout.tsx#L22-L35)
- The REST adapter calls handleEndpoints, whose Fetch Request/Response interface is documented for other backend frameworks; routing selects root, collection, or global endpoint tables. — [packages/next/src/routes/rest/index.ts#L34-48](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/next/src/routes/rest/index.ts#L34-L48) [packages/payload/src/utilities/handleEndpoints.ts#L31-34](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L31-L34) [packages/payload/src/utilities/handleEndpoints.ts#L179-198](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L179-L198)
- Shared admin renderRoot accepts injected context initialization, view adapters, redirect, and notFound functions; its route-key contract explicitly accommodates TanStack Start and Next.js remount differences. — [packages/ui/src/views/Root/index.tsx#L42-64](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/views/Root/index.tsx#L42-L64) [packages/ui/src/views/Root/adminViews.tsx#L30-55](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/views/Root/adminViews.tsx#L30-L55)
- BasePayload initializes config.db and config.kv independently, then initializes a configured email adapter or falls back to consoleEmailAdapter. — [packages/payload/src/index.ts#L992-1019](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L992-L1019)
- MongoDB creation uses Mongoose Model.create and session-aware transforms; postgresAdapter imports CRUD, version, transaction, and migration implementations from @payloadcms/drizzle. — [packages/db-mongodb/src/create.ts#L24-29](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L24-L29) [packages/db-mongodb/src/create.ts#L51-75](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L51-L75) [packages/db-postgres/src/index.ts#L4-61](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-postgres/src/index.ts#L4-L61)
- build:core excludes plugin and storage packages plus templates, build:all broadens package builds, and Turbo orders builds through dependency builds while caching dist output. — [package.json#L12-22](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L12-L22) [turbo.json#L8-16](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/turbo.json#L8-L16)
- Deployment documentation describes Next.js hosting with separately provisioned database, permanent file storage, email, and CDN requirements; the Astro example instead provides separate Payload and website development commands. — [docs/production/deployment.mdx#L14-46](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/production/deployment.mdx#L14-L46) [examples/astro/package.json#L9-13](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/examples/astro/package.json#L9-L13)

## Feature catalog

The inspected features cover editor workflows, application APIs, authentication, uploads, localization, and background work. Configured schemas determine which entities and capabilities appear. CLI commands provide another operational surface, while optional packages add specialized product functionality. This catalog groups evidenced capabilities and does not claim exhaustive coverage of every package or screen.
- The default admin view registry includes dashboard, account, first-user creation, login, logout, inactivity logout, password recovery/reset, verification, unauthorized, and not-found screens. — [packages/ui/src/views/Root/adminViews.tsx#L36-55](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/views/Root/adminViews.tsx#L36-L55)
- Collection REST endpoints provide count, create, bulk and single deletion, document access, list and single reads, duplicate, version listing/detail/restoration, and bulk or single PATCH updates. — [packages/payload/src/collections/endpoints/index.ts#L25-55](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/endpoints/index.ts#L25-L55) [packages/payload/src/collections/endpoints/index.ts#L63-95](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/endpoints/index.ts#L63-L95)
- Payload exposes Local, REST, and GraphQL APIs; the Next GraphQL POST handler generates a schema from config, applies validation rules, and returns 404 when graphQL.disable is enabled. — [docs/getting-started/concepts.mdx#L59-76](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/getting-started/concepts.mdx#L59-L76) [packages/next/src/routes/graphql/handler.ts#L98-145](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/next/src/routes/graphql/handler.ts#L98-L145)
- Local login supports configured email and/or username identities, account locking, optional verified-email enforcement, optional sessions, and opportunistic migration of stored password hashes. — [packages/payload/src/auth/operations/login.ts#L110-155](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L110-L155) [packages/payload/src/auth/operations/login.ts#L206-248](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L206-L248) [packages/payload/src/auth/operations/login.ts#L280-326](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L280-L326)
- Creation supports drafts, autosave versions, localized publication status, and publishing accessible locales; scheduled publishing configuration adds a task during sanitization. — [packages/payload/src/collections/operations/create.ts#L170-194](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L170-L194) [packages/payload/src/collections/operations/create.ts#L400-424](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L400-L424) [packages/payload/src/collections/operations/create.ts#L497-507](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L497-L507) [packages/payload/src/config/sanitize.ts#L547-556](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/sanitize.ts#L547-L556)
- Uploads support multipart files, staged upload instructions, URL inputs, and local writes; S3 options additionally expose direct client uploads and signed downloads. — [packages/payload/src/utilities/addDataAndFileToRequest.ts#L35-85](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/addDataAndFileToRequest.ts#L35-L85) [packages/payload/src/uploads/resolveURLUploadInput.ts#L28-63](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/uploads/resolveURLUploadInput.ts#L28-L63) [packages/storage-s3/src/index.ts#L39-78](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/storage-s3/src/index.ts#L39-L78)
- Built-in CLI commands cover document/global operations, schema and type/import-map generation, build, migration management, and job execution/scheduling; automatic job crons conditionally schedule and run queues. — [packages/payload/src/config/defaults.ts#L6-43](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/defaults.ts#L6-L43) [packages/payload/src/index.ts#L799-850](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L799-L850)
- Documented optional features include Lexical rich text, iframe live preview using postMessage, and plugins for forms, MCP, tenancy, nested documents, redirects, search, Sentry, SEO, Stripe, import/export, and ecommerce. — [docs/rich-text/overview.mdx#L9-30](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/rich-text/overview.mdx#L9-L30) [docs/live-preview/overview.mdx#L9-13](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/live-preview/overview.mdx#L9-L13) [docs/plugins/overview.mdx#L47-61](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/plugins/overview.mdx#L47-L61)

## Data flow

Configuration is transformed before runtime state is initialized. HTTP requests acquire authentication, query, locale, and translation context before endpoint handlers consume data. Collection operations own validation and lifecycle behavior, then delegate stored representations to adapters. Returned documents are transformed again for field visibility, population, localization, and hooks before crossing the response boundary.
- buildConfig sorts plugins by order, awaits each config transformation, invokes each storage adapter's init, and finally passes the resulting config to sanitizeConfig. — [packages/payload/src/config/build.ts#L10-32](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/build.ts#L10-L32)
- createPayloadRequestFromWebRequest parses cookies, gets a cached Payload instance with crons enabled, parses query strings with depth 10 and arrayLimit 1000, and normalizes configured locales. — [packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L33-38](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L33-L38) [packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L66-94](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L66-L94)
- createPayloadRequest attaches Payload, context, i18n, user, and a request dataloader; the web wrapper then executes auth strategies and attaches the resulting user and response headers. — [packages/payload/src/utilities/createPayloadRequest.ts#L130-159](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequest.ts#L130-L159) [packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L126-140](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequestFromWebRequest.ts#L126-L140)
- Internal POST/PATCH endpoint wrappers parse data/files and body locales before calling the original handler; JSON becomes req.data, while multipart _payload supplies data and file parts populate req.files/req.file. — [packages/payload/src/utilities/wrapInternalEndpoints.ts#L6-19](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/wrapInternalEndpoints.ts#L6-L19) [packages/payload/src/utilities/addDataAndFileToRequest.ts#L16-59](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/addDataAndFileToRequest.ts#L16-L59)
- The client Form reduces fields to values, runs optional beforeSubmit and form validation, builds FormData, then either sends an HTTP request with Accept-Language or calls a function action. — [packages/ui/src/forms/Form/index.tsx#L318-345](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/forms/Form/index.tsx#L318-L345) [packages/ui/src/forms/Form/index.tsx#L355-366](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/forms/Form/index.tsx#L355-L366) [packages/ui/src/forms/Form/index.tsx#L395-412](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/forms/Form/index.tsx#L395-L412)
- createLocal resolves a collection, defaults overrideAccess to false, constructs request context, and resolves req.file from an explicit file or filePath before entering the shared create path. — [packages/payload/src/collections/operations/local/create.ts#L181-219](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/local/create.ts#L181-L219)
- The MongoDB adapter transforms application data for writing, assigns database identity, obtains the request session, calls Model.create, and converts/transforms the stored result back for reading unless returning is false. — [packages/db-mongodb/src/create.ts#L24-55](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L24-L55) [packages/db-mongodb/src/create.ts#L57-75](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L57-L75)
- After persistence, createOperation sanitizes internal fields, optionally saves a version and sends verification email, runs field/collection afterRead and afterChange hooks, then cleans temporary files and commits its transaction. — [packages/payload/src/collections/operations/create.ts#L482-523](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L482-L523) [packages/payload/src/collections/operations/create.ts#L530-576](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L530-L576) [packages/payload/src/collections/operations/create.ts#L582-623](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L582-L623)

## Behavior traces

Three concrete paths were followed through implementation: instance startup, REST document creation through MongoDB persistence, and REST login through cookie issuance. Startup shares concurrent initialization work and conditionally activates development and cron behavior. Creation branches for auth collections, uploads, drafts, and versions before shaping the response. Login authenticates before starting its remaining transaction and includes explicit session cleanup on failure.
- Startup begins getPayload → cache lookup by key/default → shared initialization promise → new BasePayload().init; initialization failures clear the promise and mark the error as payloadInitError. — [packages/payload/src/index.ts#L1310-1335](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1310-L1335) [packages/payload/src/index.ts#L1380-1400](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1380-L1400)
- BasePayload.init awaits config → initializes logger → requires secret → builds the active/previous-secret keyring → registers collections/blocks → initializes DB and KV → optionally connects DB → initializes email. — [packages/payload/src/index.ts#L924-939](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L924-L939) [packages/payload/src/index.ts#L961-980](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L961-L980) [packages/payload/src/index.ts#L992-1019](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L992-L1019)
- Startup then collects custom and API-key auth strategies, appends local JWT when enabled, runs options/config onInit unless disabled, and invokes _initializeCrons only when requested. — [packages/payload/src/index.ts#L1049-1100](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1049-L1100)
- REST creation runs exported POST → Next handlerBuilder → handleEndpoints → createPayloadRequestFromWebRequest → endpoint matching and routeParams injection → wrapped body parsing → createHandler → createOperation. — [app/(payload)/api/[...slug]/route.ts#L2-9](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/app/(payload)/api/%5B...slug%5D/route.ts#L2-L9) [packages/next/src/routes/rest/index.ts#L34-45](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/next/src/routes/rest/index.ts#L34-L45) [packages/payload/src/utilities/handleEndpoints.ts#L220-269](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L220-L269) [packages/payload/src/collections/endpoints/create.ts#L11-26](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/endpoints/create.ts#L11-L26)
- createOperation starts a transaction, strips submitted upload identity for non-overridden upload requests, runs beforeOperation, enforces create access unless overridden, generates file data, then runs field/collection validation and change hooks. — [packages/payload/src/collections/operations/create.ts#L86-108](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L86-L108) [packages/payload/src/collections/operations/create.ts#L137-142](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L137-L142) [packages/payload/src/collections/operations/create.ts#L226-250](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L226-L250) [packages/payload/src/collections/operations/create.ts#L266-353](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L266-L353)
- Creation writes local files unless disabled, calls registerLocalStrategy for local-auth collections or payload.db.create otherwise, optionally saves versions, shapes results through hooks, and commits; errors clean temporary files and kill the transaction. — [packages/payload/src/collections/operations/create.ts#L441-480](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L441-L480) [packages/payload/src/collections/operations/create.ts#L497-507](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L497-L507) [packages/payload/src/collections/operations/create.ts#L603-634](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L603-L634) [packages/db-mongodb/src/create.ts#L51-75](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L51-L75)
- REST login runs loginHandler → loginWithCookie → loginOperation → normalized identity query excluding trashed users → db.findOne → checkLoginPermission → authenticateLocalStrategy; failed passwords increment attempts when configured, and unverified users are rejected when verification is enabled. — [packages/payload/src/auth/endpoints/login.ts#L10-31](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/endpoints/login.ts#L10-L31) [packages/payload/src/auth/loginWithCookie.ts#L45-51](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/loginWithCookie.ts#L45-L51) [packages/payload/src/auth/operations/login.ts#L199-248](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L199-L248)
- Successful login starts a transaction → rechecks lock state → adds a session → optionally rehashes the password → resets attempts → runs beforeLogin → signs JWT → applies user read access and afterOperation → commits; loginWithCookie generates the cookie before optional token removal, and the handler returns Set-Cookie. — [packages/payload/src/auth/operations/login.ts#L251-326](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L251-L326) [packages/payload/src/auth/operations/login.ts#L329-362](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L329-L362) [packages/payload/src/auth/operations/login.ts#L385-432](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/operations/login.ts#L385-L432) [packages/payload/src/auth/loginWithCookie.ts#L53-64](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/loginWithCookie.ts#L53-L64) [packages/payload/src/auth/endpoints/login.ts#L33-48](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/endpoints/login.ts#L33-L48)

## Testing signals

Tests and CI were inspected, not executed; no passing result is asserted. Vitest separates unit, browser-component, RSC, integration, and evaluation projects, while Playwright covers browser workflows and visual comparisons. Read assertions demonstrate intended coverage of request construction, authentication, authorization, password migration, and selected accessibility behavior. The inventory and inspection are bounded, and neither test existence nor CI configuration establishes exhaustive coverage or runtime correctness.
- Vitest selects package/tool/unit specs for the Node unit project, TSX specs for Chromium component tests, and Next RSC specs under react-server resolution conditions. — [vitest.config.ts#L68-106](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/vitest.config.ts#L68-L106)
- The integration project selects test/**/*int.spec.ts, disables file parallelism, uses 90-second hook/test timeouts, and loads test/vitest.setup.ts; CI configures two Vitest retries. — [vitest.config.ts#L57-59](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/vitest.config.ts#L57-L59) [vitest.config.ts#L108-123](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/vitest.config.ts#L108-L123)
- Shared integration fixtures initialize/destroy Payload once per file, ordinarily reset and seed before each payload-backed test, and provide REST/SDK clients; the inspected auth suite explicitly disables between-test resets. — [test/__helpers/int/vitest.ts#L107-154](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/__helpers/int/vitest.ts#L107-L154) [test/__helpers/int/vitest.ts#L162-164](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/__helpers/int/vitest.ts#L162-L164) [test/auth/int.spec.ts#L47-50](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/auth/int.spec.ts#L47-L50)
- Read auth assertions cover successful REST login, removal of restricted user fields from login responses, owned preference updates, first-user registration rejection, and legacy password rehashing. — [test/auth/int.spec.ts#L109-119](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/auth/int.spec.ts#L109-L119) [test/auth/int.spec.ts#L540-602](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/auth/int.spec.ts#L540-L602) [test/auth/int.spec.ts#L666-710](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/auth/int.spec.ts#L666-L710)
- createPayloadRequest unit tests use mock Payload objects to check supplied URL precedence, configured serverURL fallback, and localhost fallback; these assertions do not exercise a real database or HTTP server. — [packages/payload/src/utilities/createPayloadRequest.spec.ts#L7-31](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequest.spec.ts#L7-L31) [packages/payload/src/utilities/createPayloadRequest.spec.ts#L62-95](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequest.spec.ts#L62-L95) [packages/payload/src/utilities/createPayloadRequest.spec.ts#L32-61](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/createPayloadRequest.spec.ts#L32-L61)
- The inspected WCAG Playwright suite checks the login logo's accessible name and lack of tab stop, plus column-editor headings and checkbox labels; browser configuration defines only a Chromium project. — [test/a11y/WCAG.e2e.spec.ts#L80-125](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/a11y/WCAG.e2e.spec.ts#L80-L125) [test/playwright.config.ts#L74-79](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/playwright.config.ts#L74-L79)
- Main CI configures unit/component/type checks and sharded integration tests; integration runs can exclude Canary-named tests when the upstream Next canary package probe reports an incomplete publish. — [.github/workflows/main.yml#L211-247](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L211-L247) [.github/workflows/main.yml#L274-282](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L274-L282) [.github/workflows/main.yml#L308-321](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L308-L321)
- Production E2E CI excludes @visual tests, which run in a separate path-gated visual job using pinned Playwright Docker tooling; the scripts and workflow were inspected, not executed, so their current outcomes and uninspected flows remain unverified. — [.github/workflows/main.yml#L457-465](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L457-L465) [.github/workflows/main.yml#L486-499](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L486-L499) [package.json#L128-147](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L128-L147)

## Risk map

These are source observations and explicitly marked hypotheses, not confirmed vulnerabilities. Important review boundaries include privileged API options, development autologin, secret rotation, request rewriting, configuration caches, and filesystem side effects. The inspected code contains protections as well as intentional trusted bypasses. Runtime exploitability, production configuration, and whole-repository test gaps were not established.
- createOperation skips collection create access when overrideAccess is truthy; createLocal defaults it to false. The documented low-level payload.db.batchProcessing method does not run Local API access, hooks, field validation, or upload handling, and leaves transaction lifecycle to its caller. — [packages/payload/src/collections/operations/create.ts#L226-231](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L226-L231) [packages/payload/src/collections/operations/local/create.ts#L188-204](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/local/create.ts#L188-L204) [docs/database/overview.mdx#L70-94](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/database/overview.mdx#L70-L94)
- JWTAuthentication can return a configured autologin user when no token is present and DisableAutologin is not true; that lookup uses overrideAccess: true and requires an object autologin configuration without prefillOnly. — [packages/payload/src/auth/strategies/jwt.ts#L71-77](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/strategies/jwt.ts#L71-L77) [packages/payload/src/auth/strategies/jwt.ts#L99-120](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/strategies/jwt.ts#L99-L120) [packages/payload/src/auth/strategies/jwt.ts#L138-153](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/strategies/jwt.ts#L138-L153)
- Initialization accepts active and previous secrets into a keyring; JWT verification tries every key, then checks authVersion, typed identity references, an auth-enabled local collection, and configured session membership. — [packages/payload/src/index.ts#L927-935](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L927-L935) [packages/payload/src/auth/strategies/jwt.ts#L42-51](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/strategies/jwt.ts#L42-L51) [packages/payload/src/auth/strategies/jwt.ts#L155-200](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/strategies/jwt.ts#L155-L200)
- External URL resolution enforces upload policy, HTTP(S), and an allow-list by default, suppresses forwarded headers by default, and checks downloaded size; trusted callers may opt out of requiring an allow-list. — [packages/payload/src/uploads/validateUploadURL.ts#L21-49](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/uploads/validateUploadURL.ts#L21-L49) [packages/payload/src/uploads/resolveURLUploadInput.ts#L28-60](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/uploads/resolveURLUploadInput.ts#L28-L60)
- Hypothesis: file or email side effects may need compensation after later create failures because local uploads and verification email precede commit, while the shown catch path removes temporary files and rolls back the database transaction. (inferred) — [packages/payload/src/uploads/uploadFiles.ts#L15-24](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/uploads/uploadFiles.ts#L15-L24) [packages/payload/src/collections/operations/create.ts#L441-443](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L441-L443) [packages/payload/src/collections/operations/create.ts#L514-523](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L514-L523) [packages/payload/src/collections/operations/create.ts#L619-633](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L619-L633)
- The JSON POST-to-GET override branch appends fallbackLocale using data.depth rather than data.fallbackLocale, and uses '&' even when no locale query was added; this is a source-level discrepancy requiring reproduction, not a confirmed security issue. — [packages/payload/src/utilities/handleEndpoints.ts#L85-112](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L85-L112)
- getPayload caches by supplied key or 'default', rather than comparing configuration identity; getGraphql uses one global schema cache outside development. Multiple-config integrations must account for these cache boundaries. — [packages/payload/src/index.ts#L1301-1335](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1301-L1335) [packages/payload/src/index.ts#L1374-1377](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1374-L1377) [packages/next/src/routes/graphql/handler.ts#L65-95](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/next/src/routes/graphql/handler.ts#L65-L95)
- The root development Next config sets ignoreBuildErrors: true; development Payload initialization can spawn generate:types through a Node child process, and production test-preparation scripts delete/recreate working directories. — [next.config.mjs#L14-28](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/next.config.mjs#L14-L28) [packages/payload/src/index.ts#L869-873](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L869-L873) [packages/payload/src/index.ts#L982-990](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L982-L990) [package.json#L97-99](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L97-L99)

## Extension points

Configuration transformation is the primary extension mechanism. Runtime factories bind database, storage, authentication, and email implementations to a Payload instance. Endpoint tables and CLI command definitions expose additional behavior without replacing the core operation pipeline. Admin components, lifecycle hooks, jobs, and rich-text features provide more targeted customization surfaces.
- Plugins are ordered config-to-config transformations: buildConfig sorts by plugin.order with zero as the default and awaits each result before sanitization. — [packages/payload/src/config/build.ts#L10-17](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/build.ts#L10-L17) [docs/plugins/overview.mdx#L30-34](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/plugins/overview.mdx#L30-L34)
- Storage adapters belong in config.storage and must expose init; s3Storage returns a named adapter with collection membership and an init function that binds cloud-storage behavior. — [packages/payload/src/config/build.ts#L19-29](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/build.ts#L19-L29) [packages/storage-s3/src/index.ts#L111-157](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/storage-s3/src/index.ts#L111-L157)
- createDatabaseAdapter supplies default batching, copy, migration, and null transaction implementations that adapter arguments can override; postgresAdapter also accepts schema lifecycle hooks and query operator handlers. — [packages/payload/src/database/createDatabaseAdapter.ts#L42-64](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/database/createDatabaseAdapter.ts#L42-L64) [packages/db-postgres/src/index.ts#L101-121](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-postgres/src/index.ts#L101-L121)
- Root, collection, and global endpoint arrays are dispatched by method plus path-to-regexp matching; route parameters receive the resolved collection/global slug, and endpoints:false disables that endpoint surface. — [packages/payload/src/utilities/handleEndpoints.ts#L188-217](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L188-L217) [packages/payload/src/utilities/handleEndpoints.ts#L220-244](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L220-L244)
- Custom auth strategies are collected from auth-enabled collections before API-key/local JWT behavior; executeAuthStrategies invokes them in order, merges response headers, logs thrown errors, and returns on the first user. — [packages/payload/src/index.ts#L1049-1079](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L1049-L1079) [packages/payload/src/auth/executeAuthStrategies.ts#L14-37](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/auth/executeAuthStrategies.ts#L14-L37)
- config.cli.commands overrides built-ins and accepts disabled entries or dynamically imported command definitions; loading resolves paths relative to configDir and validates name/alias conflicts. — [packages/payload/src/config/defaults.ts#L80-87](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/defaults.ts#L80-L87) [packages/payload/src/cli/program/loadCommands.ts#L18-51](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/cli/program/loadCommands.ts#L18-L51) [packages/payload/src/cli/program/loadCommands.ts#L66-103](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/cli/program/loadCommands.ts#L66-L103)
- Admin customization types expose providers, navigation, sidebar tabs, user-menu settings, named/custom views, dashboard widgets, dependencies, and import-map generators. — [packages/payload/src/config/types.ts#L1111-1158](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/types.ts#L1111-L1158) [packages/payload/src/config/types.ts#L1161-1193](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/types.ts#L1161-L1193)
- Collection hooks can transform create data before validation/change and results after read/change; jobs tasks/workflows enable internal queue collections, while Lexical exposes replaceable feature composition. — [packages/payload/src/collections/operations/create.ts#L296-325](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L296-L325) [packages/payload/src/collections/operations/create.ts#L550-595](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L550-L595) [packages/payload/src/config/sanitize.ts#L559-605](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/sanitize.ts#L559-L605) [docs/rich-text/overview.mdx#L53-65](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/docs/rich-text/overview.mdx#L53-L65)

## Contributor handoff

Read the relevant configuration, operation, adapter, and feature fixture before editing across boundaries. Tests and CI were inspected, not executed; the suggested commands are future verification choices, not results from this investigation. The inventory is bounded, and environment files were intentionally excluded under the read-only authority. Preserve small changes and distinguish runtime behavior from stale prose, configured bypasses, and generated wiring.
- Use the current manifest and source for version-sensitive decisions: package.json says 4.0.0-canary.37, while AGENTS.md architecture notes still describe Payload 3.x and incorrectly generalize database adapters as Drizzle-based relative to MongoDB implementation. — [package.json#L1-5](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L1-L5) [AGENTS.md#L28-35](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L28-L35) [packages/db-mongodb/src/create.ts#L1-10](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/db-mongodb/src/create.ts#L1-L10)
- Before changing startup or config features, read buildConfig, sanitizeConfig, and BasePayload.init: sanitization injects internal collections and jobs, and initialization binds the actual runtime adapters. — [packages/payload/src/config/build.ts#L10-32](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/build.ts#L10-L32) [packages/payload/src/config/sanitize.ts#L569-646](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/config/sanitize.ts#L569-L646) [packages/payload/src/index.ts#L992-1019](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/index.ts#L992-L1019)
- For HTTP mutations, inspect handleEndpoints, wrapInternalEndpoints, and the shared collection operation; body parsing and slug injection occur before operation-level authorization and persistence. — [packages/payload/src/utilities/handleEndpoints.ts#L234-269](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/handleEndpoints.ts#L234-L269) [packages/payload/src/utilities/wrapInternalEndpoints.ts#L6-19](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/utilities/wrapInternalEndpoints.ts#L6-L19) [packages/payload/src/collections/operations/create.ts#L226-250](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/payload/src/collections/operations/create.ts#L226-L250)
- Follow repository conventions for object arguments, types, separate import type statements, translated config labels, stable hook arguments, and logger objects using msg/err. — [AGENTS.md#L55-66](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L55-L66) [AGENTS.md#L87-90](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L87-L90)
- Server components must reference client exports through the prescribed client bundle, and explicit named exports are required for new bundling work; the shared root renderer demonstrates the client-boundary import. — [AGENTS.md#L443-458](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L443-L458) [packages/ui/src/views/Root/index.tsx#L20-24](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/packages/ui/src/views/Root/index.tsx#L20-L24)
- Payload-backed integration tests should use the shared test.suite wrapper and fixture arguments; fixtures own initialization/reset/destruction, while files and other non-database side effects require test cleanup. — [AGENTS.md#L167-180](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L167-L180) [AGENTS.md#L199-203](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L199-L203) [test/__helpers/int/vitest.ts#L107-129](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/test/__helpers/int/vitest.ts#L107-L129)
- Future verification can start with focused unit or integration scripts, then adapter-specific integration or production E2E checks as needed; tests and CI were inspected, not executed, and production preparation contains destructive directory-reset steps that are outside this read-only task. — [package.json#L97-99](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L97-L99) [package.json#L128-144](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/package.json#L128-L144) [.github/workflows/main.yml#L308-321](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/.github/workflows/main.yml#L308-L321)
- For UI changes, apply the repository accessibility requirements and token/CSS conventions; generate visual baselines only in the pinned Playwright Docker environment, and do not infer correctness from Next builds that ignore type errors. — [AGENTS.md#L64-66](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L64-L66) [AGENTS.md#L251-260](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L251-L260) [AGENTS.md#L367-416](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/AGENTS.md#L367-L416) [next.config.mjs#L19-21](https://github.com/payloadcms/payload/blob/e6cd442f40563b2dd95cebcc6a3ffaa2dbbc68f2/next.config.mjs#L19-L21)

Source repository: https://github.com/payloadcms/payload
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/payload.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
