mkhoirulwafa18

payload nextcloud

by mkhoirulwafa18
Cloud storage
v3
^3.37.0
MIT

Overview

Summary generated from the README

Stores Payload upload files in Nextcloud through WebDAV and can create public share links using the OCS Files Sharing API. It is added to the Payload config as a plugin and enabled per upload collection. It requires Payload 3.37 or newer, the cloud-storage plugin and webdav packages, and a Nextcloud account, preferably with an app password.

Features

  • Uploads files to Nextcloud through WebDAV
  • Optionally creates public share links and stores them on the document
  • Stores a direct WebDAV URL for internal use
  • Adds read-only Nextcloud metadata fields in an admin sidebar group
  • Maps custom WebDAV properties to editable fields via PROPPATCH
  • Tracks last sync time and errors in a sync status group

Use cases

  • Keep Payload media on a self-hosted Nextcloud instead of local disk or a public cloud bucket
  • Share uploaded files through public Nextcloud links without manual steps

From the author

A Payload CMS plugin that integrates Nextcloud as a storage adapter

Installation

npm i payload-nextcloud

2

Stars

0

Forks

0

Open Issues

11 months ago

Last Updated

0

Weekly Downloads

v0.1.0

npm Version

108.6 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

39/100Fair

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/1093935074-root.svg)](https://payloaddirectory.dev/plugins/1093935074-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1093935074-root"><img src="https://payloaddirectory.dev/badge/1093935074-root.svg" alt="Payload Directory"></a>
Updated Nov 11, 2025Created Nov 11, 2025Published Nov 11, 2025

README

payload-nextcloud

Nextcloud storage adapter for Payload CMS (Payload 3). It integrates Nextcloud WebDAV for file uploads and can automatically create public share links via the OCS Files Sharing API.

Features

  • Upload files to Nextcloud via WebDAV
  • Optional public share link creation (sets nextcloud.share_url on uploaded document)
  • Exposes a direct WebDAV URL (nextcloud.webdav_url) for internal use
  • Adds an admin sidebar group with Nextcloud metadata and sync status fields

Requirements

  • Payload ^3.37.0 (peerDependency)
  • Node 18+ (or 20+)
  • A Nextcloud account and preferably an App Password (token)

Install

pnpm add payload-nextcloud @payloadcms/plugin-cloud-storage webdav

Quick start Add the plugin to your Payload config and supply Nextcloud credentials and WebDAV settings.

// payload.config.ts
import { payloadNextcloud } from 'payload-nextcloud'

export default buildConfig({
  collections: [
    {
      slug: 'media',
      upload: {
        mimeTypes: ['image/*', 'application/pdf'],
      },
      fields: [/* your fields */],
    },
  ],
  plugins: [
    payloadNextcloud({
      collections: {
        // enable integration for a collection
        media: true,
      },
      nextcloud: {
        auth: {
          username: process.env.NEXTCLOUD_USERNAME || '',
          // Prefer app password (token). Provide ONE of token or password.
          token: process.env.NEXTCLOUD_TOKEN,
          // password: process.env.NEXTCLOUD_PASSWORD,
        },
        metadata: {
          // optional custom WebDAV properties namespace + field map
          customPropertiesNamespace: 'http://payloadcms.com/ns/nextcloud',
          fieldMap: {
            'nextcloud.custom_metadata.title': 'pc:title',
            'nextcloud.custom_metadata.description': 'pc:description',
          },
        },
        webdav: {
          // Base Nextcloud URL, e.g. https://cloud.example.com
          baseUrl: process.env.NEXTCLOUD_URL || '',
          // If omitted, defaults to /remote.php/dav/files/{username}
          filesPath: process.env.NEXTCLOUD_FILESPATH,
          // Optional root directory under the user's files area
          rootDirectory: process.env.NEXTCLOUD_ROOTDIR || '/Payload',
          timeoutMs: 15000,
          // verifyTLS: false, // only in dev with self-signed certs
        },
      },
    }),
  ],
})

What gets added to your Media collection

  • A nextcloud group in the sidebar with read-only fields:
    • fileId, path, name, size, mimeType, etag, lastModified, permissions, isDirectory
    • webdav_url (direct WebDAV path)
    • share_url (public link if sharing succeeds)
  • A custom_metadata group (optional editable fields you can sync via WebDAV PROPPATCH)
  • A sync_status group to track last sync and errors

Public share links

  • On successful upload, the plugin attempts to create a public share via Nextcloud OCS API.
  • If successful, nextcloud.share_url will be set to the base public link.
  • If you prefer a direct binary URL, consider using ${share_url}/download in your app.

Nextcloud app password guidance

  • Strongly recommended: create an App Password in Nextcloud and use it as your token.
    • Nextcloud: Settings → Security → Create new app password → copy the generated password
    • Use that value as NEXTCLOUD_TOKEN; do not share your main account password
  • OCS API requires the OCS-APIRequest: true header and Basic auth—we handle this internally.
  • For self-signed certificates in dev, you can temporarily set verifyTLS: false (avoid in production).

Development notes

  • This package’s top-level exports point to dist, not src.
  • You need to build before running the dev project:
    • pnpm build
    • pnpm dev
  • The dev folder is for local testing only and is not published.

License MIT

Author / Support Update package.json with your name and repository URL. Tag your repo with payload-plugin on GitHub for discoverability.

Similar plugins