payloadcms

plugin cloud

Official
by payloadcms
Cloud storage
v1
v2
^1.8.2 || ^2.0.0
MIT

Overview

Summary generated from the README

Connects a Payload instance to the resources provided by Payload Cloud. It stores uploaded media in S3 behind a CDN, sends email through Resend, and caches upload collections. Each feature can be disabled through plugin options. It only runs when the environment variables set by Payload Cloud are present, and an existing email transport in the config takes precedence.

Features

  • Stores all upload collection media in S3 instead of local disk
  • Email delivery through Resend for Payload Cloud customers
  • CDN caching of upload collections with a 24 hour default max age
  • Per-collection cache settings, with invalidation on update or delete
  • Options to opt out of storage, email or upload caching
  • Does nothing unless Payload Cloud environment variables are set

Use cases

  • Host a Payload project on Payload Cloud with managed file storage
  • Send transactional email without configuring a separate provider
  • Access Payload Cloud file storage from a local environment using environment variables

From the author

The official Payload Cloud plugin

Installation

npm i @payloadcms/plugin-cloud

5

Stars

0

Forks

0

Open Issues

3 years ago

Last Updated

0

Weekly Downloads

v

npm Version

Dependencies

GitHub stars

50 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20265
Dec 5, 20265
Dec 4, 20265
Dec 3, 20265
Dec 2, 20265
Dec 1, 20265
Nov 30, 20265
Nov 29, 20265
Nov 28, 20265
Nov 27, 20265
Nov 26, 20265
Nov 25, 20265
Nov 24, 20265
Nov 23, 20265
Nov 22, 20265
Nov 21, 20265
Nov 20, 20265
Nov 19, 20265
Nov 18, 20265
Nov 17, 20265
Nov 16, 20265
Nov 15, 20265
Nov 14, 20265
Nov 13, 20265
Nov 12, 20265
Nov 11, 20265
Nov 10, 20265
Nov 9, 20265
Nov 8, 20265
Nov 7, 20265
Nov 6, 20265
Nov 5, 20265
Nov 4, 20265
Nov 3, 20265
Nov 2, 20265
Nov 1, 20265
Oct 31, 20265
Oct 30, 20265
Oct 29, 20265
Oct 28, 20265
Oct 27, 20265
Oct 26, 20265
Oct 25, 20265
Oct 24, 20265
Oct 23, 20265
Oct 22, 20265
Oct 21, 20265
Oct 20, 20265
Oct 19, 20265
Oct 18, 20265
Oct 17, 20265
Oct 16, 20265
Oct 15, 20265
Oct 14, 20265
Oct 13, 20265
Oct 12, 20265
Oct 11, 20265
Oct 10, 20265
Oct 9, 20265
Oct 8, 20265
Oct 7, 20265
Oct 6, 20265
Oct 5, 20265
Oct 4, 20265
Oct 3, 20265
Oct 2, 20265
Oct 1, 20265
Sep 30, 20265
Sep 29, 20265
Sep 28, 20265
Sep 27, 20265
Sep 26, 20265
Sep 25, 20265
Sep 24, 20265
Sep 23, 20265
Sep 22, 20265
Sep 21, 20265
Sep 20, 20265
Sep 19, 20265
Sep 18, 20265
Sep 17, 20265
Sep 16, 20265
Sep 15, 20265
Sep 14, 20265
Sep 13, 20265
Sep 12, 20265
Sep 11, 20265
Sep 10, 20265
Sep 9, 20265
Sep 8, 20265
Sep 7, 20265
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

0/100Archived

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/612505444-root.svg)](https://payloaddirectory.dev/plugins/612505444-root)
HTML
<a href="https://payloaddirectory.dev/plugins/612505444-root"><img src="https://payloaddirectory.dev/badge/612505444-root.svg" alt="Payload Directory"></a>
Updated Oct 12, 2023Created Mar 11, 2023

README

Payload Cloud Plugin

📢 Moved to Payload Monorepo 📢

This is the official Payload Cloud plugin that connects your Payload instance to the resources that Payload Cloud provides.

File storage

Payload Cloud gives you S3 file storage backed by Cloudflare as a CDN, and this plugin extends Payload so that all of your media will be stored in S3 rather than locally.

Email delivery

Payload Cloud provides an email delivery service out-of-the-box for all Payload Cloud customers. Powered by Resend.

Upload caching

Payload Cloud provides a caching for all upload collections by default through Cloudflare's CDN.

How to use

Add the plugin to your Payload config

yarn add @payloadcms/plugin-cloud

import { payloadCloud } from '@payloadcms/plugin-cloud'
import { buildConfig } from 'payload/config'

export default buildConfig({
  plugins: [payloadCloud()]
  // rest of config
})

NOTE: If your Payload config already has an email with transport, this will take precedence over Payload Cloud's email service.

Optional configuration

If you wish to opt-out of any Payload cloud features, the plugin also accepts options to do so.

payloadCloud({
  storage: false, // Disable file storage
  email: false,   // Disable email delivery
  uploadCaching: false // Disable upload caching
})
Upload Caching Configuration

If you wish to configure upload caching on a per-collection basis, you can do so by passing in a keyed object of collection names. By default, all collections will be cached for 24 hours (86400 seconds). The cache is invalidated when an item is updated or deleted.

payloadCloud({
  uploadCaching: {
    maxAge: 604800, // Override default maxAge for all collections
    collection1Slug: {
      maxAge: 10 // Collection-specific maxAge, takes precedence over others
    },
    collection2Slug: {
      enabled: false // Disable caching for this collection
    }
  }
})

Accessing File Storage from Local Environment

This plugin works off of a specific set of environment variables in order to access your file resources. Here is this list with some prefilled.

PORT=3000
MONGODB_URI=
PAYLOAD_CLOUD=true
PAYLOAD_CLOUD_ENVIRONMENT=prod
PAYLOAD_CLOUD_BUCKET=
PAYLOAD_CLOUD_COGNITO_IDENTITY_POOL_ID=
PAYLOAD_CLOUD_COGNITO_USER_POOL_CLIENT_ID=
PAYLOAD_CLOUD_COGNITO_USER_POOL_ID=
PAYLOAD_CLOUD_PROJECT_ID=
PAYLOAD_CLOUD_COGNITO_PASSWORD=
PAYLOAD_CLOUD_BUCKET_REGION=

PAYLOAD_SECRET=
  • MONGODB_URI is on the the Database tab.
  • PAYLOAD_CLOUD_PROJECT_ID is from Settings -> Billing.
  • PAYLOAD_SECRET is from Settings -> Environment Variables

The remaining values can be seen on your project's File Storage tab. You'll have to match up the values appropriately. We plan on adding the ability to easily copy these values in the near future.

Future enhancements

API CDN

In the future, this plugin will also ship with a way to dynamically cache API requests as well as purge them whenever a resource is updated.

When it executes

This plugin will only execute if the required environment variables set by Payload Cloud are in place. If they are not, the plugin will not execute and your Payload instance will behave as normal.

Similar plugins

View on GitHubView on npmOfficial Payload plugin