Skip to content

Repository files navigation

Bunny.net Storage for Payload

Bunny.net Storage for Payload

Bunny.net — Fast Global CDN

Store files and stream video from Payload CMS on Bunny's fast global CDN.

GitHub release npm version npm downloads CI Documentation license Ko-fi

Features

  • Bunny Storage — upload files, images, and documents to Bunny's global CDN.
  • Bunny Stream — video with HLS/MP4 streaming, adaptive bitrates, thumbnails, and TUS resumable uploads for large files.
  • Client-direct uploads — file bytes go straight from the browser to Bunny (presigned S3 or a Bunny Edge Script), bypassing serverless body-size limits.
  • Signed URLs — time-limited links with country restrictions and per-client IPv4 locking, for both Storage and Stream.
  • CDN cache purging — auto-invalidate on upload and delete so visitors always see the latest file.
  • Thumbnails — admin-panel and API previews, with on-the-fly resizing via Bunny Optimizer.
  • Per-collection overrides — tune any setting per collection, or point a collection at its own zone / library for multi-tenant setups.
  • Setup wizard & CLI — one command provisions your Bunny resources and prints a ready-to-paste config; a second deploys the client-uploads Edge Script.

Quick start

Requires Payload CMS 3.83.0 or later and Node.js 22 or later.

Important

Upgrading from v2? v3 renames/removes several config keys (the plugin throws a clear error at startup) and requires a one-time data migration of stored Stream metadata into the new bunnyData field. Back up your database and follow the Upgrade Guide — skipping the migration leaves existing videos with broken thumbnails and empty metadata.

Setup wizard (recommended)

One interactive command provisions the Bunny resources you need — storage zone, pull zone, and/or video library — with production defaults, then prints a ready-to-paste bunnyStorage({ … }) block and the matching .env lines. Nothing billable is created without confirmation.

npx @seshuk/payload-storage-bunny init

See the Setup Wizard docs. Prefer to wire it up by hand? Follow the Quick Start.

Install

npm install @seshuk/payload-storage-bunny
yarn add @seshuk/payload-storage-bunny
pnpm add @seshuk/payload-storage-bunny

Configure

Add the plugin to your Payload config, pointing it at an upload collection:

import { buildConfig } from 'payload'
import { bunnyStorage } from '@seshuk/payload-storage-bunny'

export default buildConfig({
  plugins: [
    bunnyStorage({
      collections: {
        media: {
          prefix: 'media',
          disablePayloadAccessControl: true, // serve directly from Bunny's CDN
        },
      },
      storage: {
        apiKey: process.env.BUNNY_STORAGE_API_KEY,
        hostname: process.env.BUNNY_STORAGE_HOSTNAME, // your Pull Zone host, e.g. example.b-cdn.net
        zoneName: process.env.BUNNY_STORAGE_ZONE_NAME,
      },
    }),
  ],
})

Add stream for video, purge for cache invalidation, signedUrls for secure links, and more — see the configuration reference.

Documentation

Full docs are at https://payload-storage-bunny.seshuk.im/:

Telemetry

The plugin sends an anonymous, opt-out usage report once per day: plugin, Payload, and Node versions plus which features are enabled. It never sends secrets, IPs, keys, zone/library names, hostnames, countries, file paths, or collection names. A one-time notice prints on first run.

Opt out with telemetry: false, DO_NOT_TRACK=1, or BUNNY_TELEMETRY_DISABLED=1 (also disabled automatically in CI and when payload.config.telemetry is false). See Telemetry for the full list of what is and isn't collected.

Related plugins

Support

Bug reports, feature requests, and questions go to GitHub Issues. For Payload itself, see the Payload CMS docs and Discord.

License

MIT — see LICENSE.

Credits

Built by Maxim Seshuk for the Payload CMS community.

If this plugin saves you time, you can buy me a coffee


Disclosure: links to bunny.net in this README are referral links.

Releases

Sponsor this project

Used by

Contributors

Languages