rubix-studios-pty-ltd

payload dub

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

Overview

Summary generated from the README

Integrates Payload with Dub, either or a self-hosted instance, so published documents automatically get a shortlink, tag and color. It adds collections for links, tags and analytics, and per-collection options for slug override. Requires a Dub API key and a site URL, and targets Payload v4, with a separate release line for v3.

Features

  • Creates and updates shortlinks when documents are published or slugs change
  • Create and remove Dub tags directly from Payload
  • Analytics dashboard for campaign attribution, with advanced reporting on Pro
  • Per-collection slug override for folders and shortlinks
  • Access, admin and field overrides for the link, tag and analytics collections
  • Optional custom domain, self-hosted base URL and tenant identifier

Use cases

  • Generate trackable short URLs for blog posts or news items as they are published
  • Review link click analytics and campaign attribution without leaving the Payload admin

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

Yesterday

Last Updated

0

Weekly Downloads

v2.0.2

npm Version

91.1 KB

Unpacked Size

2

Dependencies

GitHub stars

Trends appear after 7 days of data. Daily snapshots have not started yet.

npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

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

Health Score

66/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/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 Oct 20, 2026Created Oct 17, 2025Published Oct 18, 2026

README

PayloadCMS + Dub Plugin

A Payload CMS plugin that integrates with Dub to automatically create and manage shortlinks for your content. This plugin synchronizes your Payload collections with Dub.co, ensuring that every published document gets a corresponding shortlink, tag, and color configuration.

npm version Release

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

Create a free Dub account: Dub

Link Analytics Dashboard

Compatibility

The plugin maintains two release lines, with Payload CMS v4 as the primary release and Payload CMS v3 maintained separately.

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

Install the release matching your Payload version. The latest tag targets Payload v4 after the v4 release is published.

Installation

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

export default buildConfig({
  plugins: [
    payloadDub({
      baseUrl: process.env.DUB_BASE_URL, // Optional: self hosted Dub url
      collections: [
        { docs: 'posts', slugOverride: 'post' }, // Custom slug used for folder and shortlinks
        { docs: 'insights', slugOverride: 'insight' }, // Custom slug only
        { docs: 'news' }, // Default behavior
      ],
      dubApiKey: process.env.DUB_API_KEY!,
      siteUrl: process.env.NEXT_PUBLIC_SITE_URL!,
      domain: 'mycustomdomain.com', // Optional: assign a custom domain
      tenantId: '12345', // Optional: tenant identifier for workspace
      isPro: false, // Optional: pro flag to enable/disable pro features

      // Optional: overrides of dubCollection
      dubCollection: {
        overrides: {
          access: {
            read: ({ req }) => !!req.user,
            create: ({ req }) => !!req.user,
          },
          admin: {
            group: 'Marketing',
            defaultColumns: ['shortLink', 'externalId'],
          },
        },
      },
      dubTagCollection: {
        overrides: {
          access: {
            read: ({ req }) => !!req.user,
          },
          admin: {
            group: 'Marketing',
            defaultColumns: ['name', 'color'],
          },
        },
      },
      dubAnalytics: {
        overrides: {
          access: {
            read: ({ req }) => !!req.user,
          },
          admin: {
            group: 'Marketing',
          },
        },
      },
    }),
  ],
})

Notes

If you do not provide optional overrides, the plugin defaults to:

  • Links readable by all
  • Tags are readable, editable, and deletable by all logged in users

Features

  • Automation: Generates and updates shortlinks when documents are published or slugs change.
  • Folders: Collections are organised in folders (Pro).
  • Tags: Tags can be created and removed directly in Payload.
  • Analytics: Dashboard for campaign attribution, with advanced reporting (Pro).
  • Sync: Keeps Payload and Dub data consistent with minimal overhead.
  • Configurable: Supports per-collection overrides for color, slug, and URL base.
  • Access Control: Access, field and admin overrides for complete CMS control.

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