Janitor

Finds orphaned uploads and unreferenced documents in Payload storage, then deletes only the entries you approve.

Community 2 MIT v0.1.0

Installation

pnpm add @seshuk/payload-plugin-janitor

About

Janitor scans a Payload project for files and documents that nothing points to anymore: upload objects left in the bucket after their document was removed, broken uploads, and records no other document references. It writes each candidate to a findings collection, so a person reviews the list in the admin before anything is removed. Deletion only touches findings marked as approved. The plugin adds two collections to the config, one for findings and one for scan runs, and wraps your existing upload collections so it can track which files they reference. A scheduled job task runs scans through Payload's jobs queue, and a dashboard widget and a field highlight component show the current state in the admin panel. Scans can also be started from code with `runJanitor` or `startJanitor`, and `purgeApproved` removes what has been signed off. Storage access goes through adapters. Separate entry points cover S3, Cloudflare R2, Bunny, Azure Blob, Google Cloud Storage, UploadThing, Vercel Blob and local disk, and the S3 adapter needs `@aws-sdk/client-s3` installed. The plugin can be turned off with `enabled: false`, which keeps the collections and translations but skips the admin and job hooks. The package is at version 1.0.0-beta.1, so option names and behaviour may still change before a stable release.

Package info

Package name
@seshuk/payload-plugin-janitor
Latest version
0.1.0
Unpacked size
1.6 MB
License
MIT
Last publish
Oct 14, 2026

More from maximseshuk

View profile

Similar plugins

More in Storage