wkentdag

payload plugin scheduler

by wkentdag
Publishing workflow
v3
>=3.90.0
MIT

Overview

Summary generated from the README

Adds a configurable publish date field to opted-in collections and globals. Setting a future date queues a native Payload schedulePublish job that runs at that time. The admin shows schedule status in the editor and list view with sorting and filtering by publish time. Requires Payload 3.90 or later, drafts enabled, and a running Payload jobs queue worker.

Features

  • Publish date field injected into chosen collections and globals
  • Queues schedulePublish jobs with waitUntil set to the chosen date
  • Schedule status shown in the document editor and list view
  • Configurable time interval and field name, label and admin options
  • Execution access mode of user or override for the scheduled job
  • SafeRelationship field that blocks publishing links to unpublished documents

Use cases

  • Schedule posts and pages to go live at a set time from the document editor
  • Sort and filter list views by upcoming publish time
  • Prevent publishing content that references unpublished documents

From the author

Scheduled posts plugin for PayloadCMS

Installation

npm i payload-plugin-scheduler

32

Stars

2

Forks

2

Open Issues

2 months ago

Last Updated

59

Weekly Downloads

v1.2.0

npm Version

113.3 KB

Unpacked Size

2

Dependencies

GitHub stars

320 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202632
Dec 4, 202632
Dec 3, 202632
Dec 2, 202632
Dec 1, 202632
Nov 30, 202632
Nov 29, 202632
Nov 28, 202632
Nov 27, 202632
Nov 26, 202632
Nov 25, 202632
Nov 24, 202632
Nov 23, 202632
Nov 22, 202632
Nov 21, 202632
Nov 20, 202632
Nov 19, 202632
Nov 18, 202632
Nov 17, 202632
Nov 16, 202632
Nov 15, 202632
Nov 14, 202632
Nov 13, 202632
Nov 12, 202632
Nov 11, 202632
Nov 10, 202632
Nov 9, 202632
Nov 8, 202632
Nov 7, 202632
Nov 6, 202632
Nov 5, 202632
Nov 4, 202632
Nov 3, 202632
Nov 2, 202632
Nov 1, 202632
Oct 31, 202632
Oct 30, 202632
Oct 29, 202632
Oct 28, 202632
Oct 27, 202632
Oct 26, 202632
Oct 25, 202632
Oct 24, 202632
Oct 23, 202632
Oct 22, 202632
Oct 21, 202632
Oct 20, 202632
Oct 19, 202632
Oct 18, 202632
Oct 17, 202632
Oct 16, 202632
Oct 15, 202632
Oct 14, 202632
Oct 13, 202632
Oct 12, 202632
Oct 11, 202632
Oct 10, 202632
Oct 9, 202632
Oct 8, 202632
Oct 7, 202632
Oct 6, 202632
Oct 5, 202632
Oct 4, 202632
Oct 3, 202632
Oct 2, 202632
Oct 1, 202632
Sep 30, 202632
Sep 29, 202632
Sep 28, 202632
Sep 27, 202632
Sep 26, 202632
Sep 25, 202632
Sep 24, 202632
Sep 23, 202632
Sep 22, 202632
Sep 21, 202632
Sep 20, 202632
Sep 19, 202632
Sep 18, 202632
Sep 17, 202632
Sep 16, 202632
Sep 15, 202632
Sep 14, 202632
Sep 13, 202632
Sep 12, 202632
Sep 11, 202632
Sep 10, 202632
Sep 9, 202632
Sep 8, 202632
Sep 7, 202632
Sep 6, 202632
npm weekly downloads

16−34 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202616
Dec 4, 202621
Dec 3, 202621
Dec 2, 202619
Dec 1, 202641
Nov 30, 202664
Nov 29, 202699
Nov 28, 202694
Nov 27, 202695
Nov 26, 2026101
Nov 25, 2026105
Nov 24, 202691
Nov 23, 202689
Nov 22, 202666
Nov 21, 202682
Nov 20, 202677
Nov 19, 202672
Nov 18, 202671
Nov 17, 202679
Nov 16, 202685
Nov 15, 2026125
Nov 14, 2026132
Nov 13, 2026159
Nov 12, 2026189
Nov 11, 2026203
Nov 10, 2026196
Nov 9, 2026200
Nov 8, 2026161
Nov 7, 2026143
Nov 6, 2026126
Nov 5, 2026100
Nov 4, 202687
Nov 3, 202685
Nov 2, 202665
Nov 1, 202656
Oct 31, 202656
Oct 30, 202654
Oct 29, 202645
Oct 28, 202640
Oct 27, 202634
Oct 26, 202628
Oct 25, 202631
Oct 24, 202643
Oct 23, 202632
Oct 22, 202640
Oct 21, 202652
Oct 20, 202657
Oct 19, 202657
Oct 18, 202656
Oct 17, 202652
Oct 16, 202673
Oct 15, 202686
Oct 14, 202683
Oct 13, 202681
Oct 12, 202681
Oct 11, 202677
Oct 10, 202670
Oct 9, 202661
Oct 8, 202647
Oct 7, 202654
Oct 6, 202671
Oct 5, 202678
Oct 4, 2026107
Oct 3, 2026122
Oct 2, 2026117
Oct 1, 2026194
Sep 30, 2026219
Sep 29, 2026277
Sep 28, 2026288
Sep 27, 2026429
Sep 26, 2026433
Sep 25, 2026461
Sep 24, 2026401
Sep 23, 2026368
Sep 22, 2026305
Sep 21, 2026283
Sep 20, 2026123
Sep 19, 2026110
Sep 18, 202687
Sep 17, 202692
Sep 16, 2026112
Sep 15, 202698
Sep 14, 2026109
Sep 13, 2026103
Sep 12, 2026104
Sep 11, 202699
Sep 10, 202672
Sep 9, 202649
Sep 8, 202656
Sep 7, 202647
Sep 6, 202650

Each point is npm's rolling 7-day download count.

Health Score

69/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/786786869-root.svg)](https://payloaddirectory.dev/plugins/786786869-root)
HTML
<a href="https://payloaddirectory.dev/plugins/786786869-root"><img src="https://payloaddirectory.dev/badge/786786869-root.svg" alt="Payload Directory"></a>
Updated Sep 18, 2026Created Apr 15, 2024Published Sep 18, 2026

README

payload-plugin-scheduler

Plugin that adds an imperative field-based scheduling flow on top of Payload's native functionality, with at-a-glance schedule status in the admin UI.

Starting in v3, Payload has a built-in workflow for scheduling posts via the job queue and "Schedule Publish" drawer. This plugin adds a configurable Date field to opted-in collections and globals that, when set to a future date, automatically queues a schedulePublish job in the background with waitUntil set to that date. This results in a more ergonomic workflow for editors where they can view the schedule status at a glance in the document editor, and sort/filter by publish time in the list view.

This plugin was originally written for Payload v2, and included a background scheduler that's since been superseded by v3's native queue. For Payload v2, use version <=0.1.3.

ci status

UI Demo

Publish date field

List view

Requirements

  • Payload >= 3.90.0

Installation

npm add payload-plugin-scheduler

Usage

After configuring the plugin, ensure that you've regenerated payload's import map, otherwise the custom components won't display.

// payload.config.ts

import { buildConfig } from 'payload'
import { ScheduledPostPlugin } from 'payload-plugin-scheduler'

import Pages from './collections/Pages'
import Posts from './collections/Posts'
import Home from './globals/Home'

export default buildConfig({
  collections: [Pages, Posts, Users],
  globals: [Home],
  plugins: [
    ScheduledPostPlugin({
      collections: ['pages', 'posts'],
      globals: ['home'],
      interval: 10,
    }),
  ],
})

Running Jobs

This plugin creates Payload Jobs; it does not run the job worker for you. Your host app is responsible for running Payload's Jobs Queue.

See Payload's docs for current deployment guidance:

Options

Enabled collections and globals must support drafts. The plugin merges the required scheduled-publish draft config into versions.drafts.schedulePublish and preserves existing version/draft settings.

collections?: string[]

ScheduledPostPlugin({
  collections: ['pages', 'posts'],
})

globals?: string[]

ScheduledPostPlugin({
  globals: ['home'],
})

interval?: number

Time interval, in minutes, passed to the Date field's time picker and Payload's scheduled-publish draft config. Defaults to 5.

ScheduledPostPlugin({
  collections: ['posts'],
  interval: 15,
})

Your job queue cron interval should match this value, eg autoRun: [{ cron: '*/5 * * * *' }].

executionAccess?: 'user' | 'override'

Controls whose access permissions Payload uses when the scheduled publish job executes. Defaults to user.

  • user stores the authenticated scheduling user's ID on the job. Payload re-checks that user's current permissions at execution time. Scheduling without an authenticated user throws an error.
  • override omits the user from the job, causing Payload to execute it with access overridden.
ScheduledPostPlugin({
  collections: ['posts'],
  executionAccess: 'override',
})

publishDate?: object

Configure the generated publish-date field.

ScheduledPostPlugin({
  collections: ['posts'],
  // these are the default values
  publishDate: {
    name: 'publish_date',
    label: 'Publish Date',
    index: true,
    admin: {
      position: 'sidebar',
    },
  },
})

All properties are configurable except type, timezone, admin.date.pickerAppearance, admin.date.timeIntervals, admin.components.afterInput, and admin.components.Cell.

Manual Field Placement

By default, the plugin injects the publish-date field into every opted-in collection and global. If you need to place the field manually, use the exported publishDate() helper.

import type { CollectionConfig } from 'payload'
import { publishDate } from 'payload-plugin-scheduler'

export const Posts: CollectionConfig = {
  slug: 'posts',
  versions: {
    drafts: true,
  },
  fields: [
    {
      type: 'tabs',
      tabs: [
        {
          label: 'Content',
          fields: [
            {
              name: 'title',
              type: 'text',
            },
          ],
        },
        {
          label: 'Publishing',
          fields: [publishDate()],
        },
      ],
    },
  ],
}

Manual placement is only valid inside collections or globals that are opted in through ScheduledPostPlugin({ collections, globals }).

You can also pass arguments to publishDate to override the global publishDate options, eg to override the admin display properties on a one-off basis. Overrides are merged with the top-level publishDate config, with name being the only field that's only configurable at the global level.

publishDate({
  admin: {
    width: '50%',
    description: 'Custom description for this collection only'
  }
})

SafeRelationship

A drop-in replacement for Payload's relationship field, this is a helper field that throws an error if a user attempts to publish a document with relationships to unpublished documents.

import type { Field } from 'payload'
import { SafeRelationship } from 'payload-plugin-scheduler'

export const featuredContent: Field = SafeRelationship({
  name: 'featured_content',
  relationTo: ['posts', 'pages'],
  hasMany: true,
})

Debugging

Set DEBUG=payload-plugin-scheduler in your runtime env to enable debug logging.

Contributing

After cloning the repo and installing dependencies, run pnpm exec simple-git-hooks to setup automatic pre-commit linting.

Migration From v2

The v3 plugin no longer creates or writes to a plugin-owned scheduled_posts collection, and it no longer uses node-schedule. Scheduled publishes are represented as native Payload schedulePublish jobs in Payload's jobs collection.

To upgrade:

  • Remove any application code that reads from or customizes scheduled_posts.
  • Configure and run Payload Jobs in the host app. Dedicated servers and serverless deployments need different worker/cron strategies.
  • If you use Payload admin.timezones, verify the resulting <fieldName>_tz values in your own scheduling flow.
  • Generate and run a new database migration.
  • Rebuild payload's import map.

Similar plugins