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

@iaskshahram/strapi-provider-upload-uploadthing

v0.1.1

Published

UploadThing provider to be used with Strapi CMS

Readme

@iaskshahram/strapi-provider-upload-uploadthing

A Strapi custom upload provider to integrate UploadThing for storing your media files.

Quick Setup Guide

1. Add Environment Variable

Add your UploadThing toekn to the .env file in your Strapi project's root:

# .env
UPLOADTHING_TOKEN="your_uploadthing_token"

(You can find this key in your UploadThing Dashboard.)

2. Configure Strapi Plugins

Update your config/plugins.ts|js file:

// path: config/plugins.ts
export default ({ env }) => ({
  // ... any other plugin configurations
  upload: {
    config: {
      provider: "@iaskshahram/strapi-provider-upload-uploadthing",
      providerOptions: {
        // This will use the UPLOADTHING_TOKEN from your .env file.
        // It fallbacks to process.env.UPLOADTHING_TOKEN if not defined here.
        token: env("UPLOADTHING_TOKEN"),
      },
      actionOptions: {
        upload: {},
        delete: {},
      },
    },
  },
});

3. Configure Strapi Middlewares (Content Security Policy)

Update your config/middlewares.ts (or config/middlewares.js) file to allow connections to UploadThing:

// path: config/middlewares.ts
export default [
  // ...other middlewares
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": [
            "'self'",
            "https:",
            "https://uploadthing.com",
            "https://*.uploadthing.com",
            "https://*.ufs.sh",
          ],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            "your-endpoint.ufs.sh", // IMPORTANT: REPLACE THIS! (e.g., "app-id.ufs.sh")
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            "your-endpoint.ufs.sh", // IMPORTANT: REPLACE THIS! (e.g., "app-id.ufs.sh")
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
];

Important: In the img-src and media-src directives, replace "your-endpoint.ufs.sh" with your actual UploadThing file URL hostname (e.g., [your-app-id].ufs.sh).

You're good to go now.

Connect with me on X/Twitter

Table of Contents

Detailed Information

Features

  • Upload files from your Strapi application to UploadThing.
  • Delete files from UploadThing through Strapi's media library.

Prerequisites

  • A Strapi project (v4 or later. This package has a peer dependency on @strapi/strapi: ^5.12.6).
  • An account with UploadThing.
  • Your UPLOADTHING_TOKEN.

Installation

Install the provider:

pnpm install @iaskshahram/strapi-provider-upload-uploadthing

Detailed Configuration Explanation

This section provides more context on the settings shown in the Quick Setup Guide.

Environment Variables

Add your UploadThing token to the .env file in the root of your Strapi project. You can find this key in your UploadThing Dashboard.

# .env
UPLOADTHING_TOKEN="your_uploadthing_token"

Note: The provider can also directly accept the token via providerOptions.token in the plugin configuration, but using an environment variable is recommended for security and flexibility. The provider's init function will prioritize providerOptions.token if set, then fallback to process.env.UPLOADTHING_TOKEN.

Plugin Configuration Details

Modify (or create) the config/plugins.ts|js file in your Strapi project to tell Strapi to use UploadThing as the upload provider.

// path: config/plugins.ts
export default ({ env }) => ({
  // ... any other plugin configurations
  upload: {
    config: {
      provider: "@iaskshahram/strapi-provider-upload-uploadthing",
      providerOptions: {
        // override the below `UPLOADTHING_TOKEN` as defined in your .env file.
        // it fallbacks to process.env.UPLOADTHING_TOKEN
        token: env("UPLOADTHING_TOKEN"),
      },
      actionOptions: {
        // These actionOptions are not currently used by this provider for custom parameters
        // but are part of the standard Strapi upload provider configuration structure.
        upload: {},
        delete: {},
      },
    },
  },
  // ... any other plugin configurations
});

Middleware Configuration Details (CSP)

To ensure that your Strapi application can load images and media from UploadThing, you need to update your Content Security Policy (CSP) in the config/middlewares.ts|js file.

Important: Replace "your-endpoint.ufs.sh" with your actual UploadThing file URL hostname. This is typically in the format [your-app-id].ufs.sh or a newer format like *.utfs.io. You can find the correct domain for your uploaded files by inspecting the URL of a file uploaded via UploadThing.

// path: config/middlewares.ts
export default [
  // ...other middlewares (ensure this list is correctly ordered as per Strapi's requirements)
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": [
            "'self'",
            "https:",
            "https://uploadthing.com",      // For UploadThing API calls
            "https://*.uploadthing.com",    // For UploadThing related services
            "https://*.ufs.sh",             // General UploadThing file storage domain
            "https://*.utfs.io",            // Newer general UploadThing file storage domain
            // Add your specific UploadThing endpoint if known and different
          ],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            "your-endpoint.ufs.sh", // REPLACE THIS with your actual UploadThing file domain
            // Example: "app-id.ufs.sh" or "*.utfs.io"
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            "market-assets.strapi.io",
            "your-endpoint.ufs.sh", // REPLACE THIS with your actual UploadThing file domain
            // Example: "app-id.ufs.sh" or "*.utfs.io"
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...other middlewares
];

Explanation of CSP Directives:

  • connect-src: Allows connections to UploadThing's API and file services.
  • img-src: Allows images to be loaded from your UploadThing storage.
  • media-src: Allows media (like videos) to be loaded from your UploadThing storage.
  • your-endpoint.ufs.sh (or *.utfs.io): This is a placeholder. You MUST replace this with the domain from which your UploadThing files are served. If you're unsure, upload a test file and check its URL.

Usage

Once configured, Strapi will automatically use the UploadThing provider for all file uploads via the Media Library or any content types that use file/image fields.

  • Uploading Files: When you upload a file in Strapi, it will be sent to your UploadThing account.
  • Deleting Files: When you delete a file from Strapi's Media Library, it will also be deleted from your UploadThing account.

Peer Dependencies

This provider requires the following peer dependencies to be installed in your Strapi project:

  • @strapi/strapi: ^5.12.6 (as specified in package.json)

Ensure your Strapi version is compatible.

Node.js Version Support

This package is compatible with the following Node.js versions (as specified in package.json):

  • >=18.0.0 <=22.x.x

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests to the GitHub repository.

License

See the LICENSE file for details.