rubix-studios-pty-ltd

payload dub

by rubix-studios-pty-ltd
Third-party services
v4
^4.0.0-beta.12
MIT

Overview

Summary generated from the README

Connects Payload to the Dub link platform and automatically creates and updates shortlinks when configured collections are published. It adds collections for links, tags and analytics to the admin panel. Requires a Dub API key and Payload 4; an older plugin release targets Payload 3.

Features

  • Automatic shortlink creation and update on publish, skipping draft saves
  • Configurable behaviour on delete and unpublish: retain or delete the link
  • Dub tags managed from within Payload
  • Link analytics and campaign reporting collection, with advanced reporting on Pro
  • Failed operations recorded and retryable through an authenticated endpoint
  • Optional folders, custom domain, namespace and tenant ownership checks

Use cases

  • Generate trackable short URLs for blog posts and news items when they are published
  • Report link performance to marketing teams inside the Payload admin
  • Share one Dub workspace across several Payload installations using namespaces

From the author

A Payload CMS plugin that integrates with Dub to automatically create and manage shortlinks for your content.

Installation

npm i @rubixstudios/payload-dub

4

Stars

0

Forks

0

Open Issues

Today

Last Updated

830

Weekly Downloads

v3.1.0

npm Version

120.3 KB

Unpacked Size

2

Dependencies

GitHub stars

4+2 since Sep 7

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

830+811 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026830
Dec 5, 2026834
Dec 4, 20261,038
Dec 3, 2026982
Dec 2, 2026761
Dec 1, 2026758
Nov 30, 20261,079
Nov 29, 2026994
Nov 28, 2026991
Nov 27, 2026967
Nov 26, 2026944
Nov 25, 2026924
Nov 24, 2026945
Nov 23, 2026770
Nov 22, 2026761
Nov 21, 20261,074
Nov 20, 20261,200
Nov 19, 2026935
Nov 18, 20261,019
Nov 17, 2026990
Nov 16, 2026859
Nov 15, 2026853
Nov 14, 2026560
Nov 13, 2026529
Nov 12, 2026611
Nov 11, 2026682
Nov 10, 2026748
Nov 9, 2026736
Nov 8, 2026732
Nov 7, 2026681
Nov 6, 2026411
Nov 5, 2026339
Nov 4, 2026222
Nov 3, 2026153
Nov 2, 2026145
Nov 1, 2026734
Oct 31, 2026731
Oct 30, 2026717
Oct 29, 2026700
Oct 28, 2026653
Oct 27, 2026805
Oct 26, 2026795
Oct 25, 2026195
Oct 24, 2026207
Oct 23, 2026198
Oct 22, 2026227
Oct 21, 2026277
Oct 20, 2026307
Oct 19, 2026887
Oct 18, 2026883
Oct 17, 2026878
Oct 16, 2026883
Oct 15, 2026855
Oct 14, 2026807
Oct 13, 2026615
Oct 12, 202627
Oct 11, 202628
Oct 10, 202624
Oct 9, 202623
Oct 8, 202628
Oct 7, 202627
Oct 6, 202619
Oct 5, 202624
Oct 4, 202624
Oct 3, 202624
Oct 2, 202626
Oct 1, 202629
Sep 30, 202636
Sep 29, 202648
Sep 28, 202656
Sep 27, 2026228
Sep 26, 2026276
Sep 25, 2026272
Sep 24, 2026267
Sep 23, 2026261
Sep 22, 2026255
Sep 21, 2026292
Sep 20, 2026117
Sep 19, 202666
Sep 18, 202665
Sep 17, 202664
Sep 16, 202662
Sep 15, 202658
Sep 14, 20268
Sep 13, 20268
Sep 12, 20269
Sep 11, 20269
Sep 10, 202613
Sep 9, 202617
Sep 8, 202618
Sep 7, 202619

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

Health Score

81/100Excellent

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/1078131883-root.svg)](https://payloaddirectory.dev/plugins/1078131883-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1078131883-root"><img src="https://payloaddirectory.dev/badge/1078131883-root.svg" alt="Payload Directory"></a>
Updated Dec 5, 2026Created Oct 17, 2025Published Dec 1, 2026

README

PayloadCMS + Dub Plugin

A Payload CMS plugin that integrates with Dub to automatically create and manage shortlinks, tags and analytics for your published content.

npm version Release

Dub is an open-source link attribution platform for short links, conversion tracking and affiliate programs.

Create a free Dub account: Dub

Link Analytics Dashboard

Compatibility

Payload CMSPlugin versionRelease branchnpm dist-tag
v43.xmainlatest
v31.xpayload-v3payload-v3

Installation

pnpm add @rubixstudios/payload-dub

For Payload CMS v3:

pnpm add @rubixstudios/payload-dub@payload-v3

Configuration

The following configuration targets the Payload v4 release.

// payload.config.ts
import { buildConfig } from 'payload/config'
import { payloadDub } from '@rubixstudios/payload-dub'

export default buildConfig({
  plugins: [
    payloadDub({
      dubApiKey: process.env.DUB_API_KEY!,
      siteUrl: process.env.NEXT_PUBLIC_SITE_URL!,
      collections: [
        { docs: 'posts', slugOverride: 'post' },
        { docs: 'insights', slugOverride: 'insight' },
        'news',
      ],
      // Optional configuration
      baseUrl: process.env.DUB_BASE_URL,
      domain: 'mycustomdomain.com',
      tenantId: '12345',
      isPro: false,
      namespace: 'my-app',
      onDelete: 'delete',
      onUnpublish: 'retain',
      autoBackfill: true,
      uniqueSources: true,
      dubCollection: {
        overrides: {
          admin: { group: 'Marketing' },
        },
      },
      dubTagCollection: {
        overrides: {
          admin: { group: 'Marketing' },
        },
      },
      dubAnalytics: {
        overrides: {
          admin: { group: 'Marketing' },
        },
      },
    }),
  ],
})

Features

  • Shortlinks: Automatically creates and updates links for published documents.
  • Folders: Organizes links into Dub folders (Pro).
  • Tags: Manages Dub tags directly within Payload.
  • Analytics: Integrated link performance and campaign reporting, with advanced reporting (Pro).
  • Synchronization: Tracks link operations and supports recovery from failed requests.
  • Access control: Restricts management to authenticated admin users by default and verifies configured tenant ownership.

Notes

  • Draft saves do not create or update shortlinks.
  • Shortlinks are deleted when source documents are deleted and retained on unpublish by default. Configure onDelete and onUnpublish with retain or delete to change this behavior.
  • Configure a stable namespace when multiple installations share a Dub workspace. Existing external IDs remain unchanged.
  • Collection and analytics overrides support custom access policies and admin settings. Preserve system-managed fields and hooks when overriding fields or hooks.

Synchronization

Failed link operations are recorded in the generated links collection. Save the published source document again to retry synchronization, or use the authenticated endpoint:

POST /api/dubLinks/{id}/retry

Use the Payload link document ID and the configured links collection slug. The endpoint respects admin authentication and collection access policies. Retries use the stored operation; save the source document again if its content has changed.

Failed direct deletions retain the local record for retry. Payload and Dub transactions are independent, so remote state may require reconciliation after a local transaction failure.

Upgrading

MongoDB automatically backfills missing source keys during initialization without contacting Dub. No configuration changes are required under normal upgrade conditions. Duplicate mappings and conflicting indexes must be resolved before continuing.

Existing SQL installations require a schema migration and source-key backfill before enforcing uniqueness. Temporarily set uniqueSources: false while preparing the migration, resolve duplicates, backfill source keys, then restore uniqueness and verify the database index.

Back up the database and pause writes during upgrades. See BACKFILL.md for additional migration guidance.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support or inquiries:

Author

Rubix Studios
https://rubixstudios.com.au

Similar plugins