Skip to Content

Uploadthing

The plugin provides image uploads and a Puck Image component. It requires a database plugin for image metadata.

Setup

Install the plugin:

npm install @oberoncms/plugin-uploadthing uploadthing

Create an Uploadthing  app. Set the credentials required by the installed Uploadthing SDK. The route handler uses UPLOADTHING_TOKEN. This plugin’s image deletion code also reads UPLOADTHING_SECRET. Set both to the app token:

UPLOADTHING_TOKEN=your-uploadthing-token UPLOADTHING_SECRET=your-uploadthing-token

Import the plugin in oberon/config.ts:

import { plugin as uploadthingPlugin } from "@oberoncms/plugin-uploadthing/plugin"

Add it after the database plugin. See Configuration for plugin order. Mount the framework HTTP handler to expose /cms/api/uploadthing.

Image component

Import Image in your client config:

import { Image } from "@oberoncms/plugin-uploadthing"

Add Image to clientConfig.components. Import the default styles in your app layout:

import "@oberoncms/plugin-uploadthing/source.css"

Uploads require image write permission. The file router accepts images up to 4 MB. Image deletion attempts both database metadata removal and provider deletion. The plugin reports failures from either operation.

Last updated on