Utilities

Helpers for extracting IDs, resolving documents and composing field validators

Community 0 3/wk MIT v1.1.1

Installation

pnpm add payload-utilities

About

Payload Utilities is a small set of helper functions for code that works with Payload documents and field validation. Relationship fields can hold either a plain ID or a full document, and these helpers let you handle both shapes without writing the checks yourself. You can pull IDs out of single values or arrays, and resolve a document only when you have an ID, so you skip fetching data you already have.

It also includes a validator composer. You write custom checks, such as making sure an end date is not before a start date, and combine them with one of Payload's built-in field validators. The custom checks run first and stop at the first failure, and the built-in validator runs once they pass.

Package info

Package name
payload-utilities
Latest version
1.1.1
Unpacked size
9 kB
License
MIT
Weekly downloads
3
Last publish
Mar 19, 2026

More from bhofstaetter

View profile

Type-safe factory functions that build Payload field configs with less boilerplate

Typed repository classes for collections and globals over the Payload Local API

Spins up a throwaway Payload instance on a test database container for integration tests

Similar tools

More in Dev workflow

Stateful test emulator of the Payload collection REST API with seeded data

Editor support for Payload component paths, with import checks and autocomplete

Governance checks and ESLint rules for Payload project structure, access code and hooks

Manifest, linter and Payload block generator for a design system's components

Automated code transforms that move a Payload project past breaking changes

Idempotent seed runner that fills a Payload database with ordered, cross-referenced content