npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

payload-plugin-social-media

v0.1.13

Published

Payload CMS 3.x plugin for multi-platform social media posting

Readme

payload-plugin-social-media

Social media plugin for Payload CMS 3. Automatically post to Bluesky, Mastodon, and Reddit when documents are published.

Features

  • Multi-platform posting (Bluesky, Mastodon, Reddit)
  • Automatic posting on document publish via background jobs
  • Manual sharing with admin UI share button
  • Template system with per-platform character limits
  • Engagement tracking (likes, reposts, replies, comments)
  • URL shortener with click and referrer analytics
  • Encrypted token storage (AES-256-GCM)
  • Admin dashboard widget and account management UI

Installation

pnpm add payload-plugin-social-media

Usage

// payload.config.ts
import { buildConfig } from 'payload';
import { socialMediaPlugin } from 'payload-plugin-social-media';

export default buildConfig({
  // ...
  plugins: [
    socialMediaPlugin({
      collections: ['posts', 'articles'],
      encryptionKey: process.env.SOCIAL_ENCRYPTION_KEY!, // 32+ characters
      baseUrl: process.env.PAYLOAD_PUBLIC_SERVER_URL!,
      platforms: ['bluesky', 'mastodon', 'reddit'],

      // Optional: Bluesky config (uses app passwords, not OAuth)
      bluesky: {
        service: 'https://bsky.social', // default
      },

      // Optional: Mastodon OAuth credentials per instance
      mastodon: {
        instances: {
          'mastodon.social': {
            clientId: process.env.MASTODON_CLIENT_ID!,
            clientSecret: process.env.MASTODON_CLIENT_SECRET!,
          },
        },
      },

      // Optional: Reddit OAuth credentials
      reddit: {
        clientId: process.env.REDDIT_CLIENT_ID!,
        clientSecret: process.env.REDDIT_CLIENT_SECRET!,
        userAgent: 'myapp/1.0',
      },
    }),
  ],
});

Configuration

| Option | Type | Required | Default | Description | |---|---|---|---|---| | collections | string[] | Yes | - | Collection slugs to enable social posting on | | encryptionKey | string | Yes | - | 32+ character key for encrypting stored tokens | | baseUrl | string | Yes | - | Base URL for short links and OAuth callbacks | | platforms | Platform[] | Yes | - | 'bluesky', 'mastodon', 'reddit' | | slugPrefix | string | No | 'social' | Prefix for plugin-created collections | | access | object | No | - | Access control overrides for plugin collections | | bluesky | object | No | - | Bluesky service URL override | | mastodon | object | No | - | Per-instance OAuth client credentials | | reddit | object | No | - | Reddit OAuth credentials and user agent |

Collections

The plugin creates five collections (prefixed with slugPrefix, default social):

| Collection | Description | |---|---| | social-accounts | Connected platform accounts with encrypted tokens | | social-templates | Post templates per platform and collection | | social-posts | Queued and published social posts | | social-interactions | Engagement metrics and comments | | social-links | Short links with click tracking |

Templates

Templates use {{variable}} syntax with these available variables:

| Variable | Description | |---|---| | {{title}} | Document title | | {{excerpt}} | Document excerpt | | {{url}} | Full document URL | | {{shortUrl}} | Shortened URL | | {{author}} | Document author | | {{collection}} | Collection name |

Content is automatically truncated to platform limits (Bluesky: 300, Mastodon: 500, Reddit: 40,000 characters).

Client Components

Import admin UI components from the /client subpath:

import {
  ShareButton,
  PostStatusField,
  EngagementPanel,
  DashboardWidget,
  ConnectAccountView,
  TemplateEditorView,
} from 'payload-plugin-social-media/client';

License

Elastic License 2.0 (ELv2). Free to use, modify, and distribute. Cannot be offered as a hosted/managed service.