Stores Payload upload collection files in Sanity Content Lake while Payload keeps media records, access control, relationships, drafts and versions. It is added as a plugin and enabled per upload collection with Sanity project credentials. Automatic asset cleanup requires the PostgreSQL adapter, and the Sanity write token must stay on the server. Requires Payload 3.94.1 or later below 4.
Sanity-powered storage for Payload CMS with an enhanced media admin UI.
Installation
npm i @klnap/payload-storage-sanity0
Stars
0
Forks
0
Open Issues
3 days ago
Last Updated
1.2k
Weekly Downloads
v0.5.0
npm Version
1.2 MB
Unpacked Size
8
Dependencies
00 since Nov 22
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
1.4K+1.4K since Sep 18
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 1,447 |
| Dec 5, 2026 | 1,455 |
| Dec 4, 2026 | 2,116 |
| Dec 3, 2026 | 1,898 |
| Dec 2, 2026 | 1,863 |
| Dec 1, 2026 | 1,791 |
| Nov 30, 2026 | 1,233 |
| Nov 29, 2026 | 904 |
| Nov 28, 2026 | 706 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
| Oct 24, 2026 | 9 |
| Oct 23, 2026 | 9 |
| Oct 22, 2026 | 9 |
| Oct 21, 2026 | 9 |
| Oct 20, 2026 | 9 |
| Oct 19, 2026 | 9 |
| Oct 18, 2026 | 9 |
| Oct 17, 2026 | 0 |
| Oct 16, 2026 | 0 |
| Oct 15, 2026 | 200 |
| Oct 14, 2026 | 200 |
| Oct 13, 2026 | 200 |
| Oct 12, 2026 | 200 |
| Oct 11, 2026 | 200 |
| Oct 10, 2026 | 200 |
| Oct 9, 2026 | 200 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 4 |
| Sep 23, 2026 | 4 |
| Sep 22, 2026 | 4 |
| Sep 21, 2026 | 4 |
| Sep 20, 2026 | 4 |
| Sep 19, 2026 | 4 |
| Sep 18, 2026 | 4 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1471027626-root)<a href="https://payloaddirectory.dev/plugins/1471027626-root"><img src="https://payloaddirectory.dev/badge/1471027626-root.svg" alt="Payload Directory"></a>README
Store Payload media files in Sanity Content Lake. Payload remains the source of media records, access control, relationships, drafts and versions; Sanity stores and serves the asset bytes.
bun add @klnap/payload-storage-sanity
# or
npm install @klnap/payload-storage-sanity
Requirements: Node.js ^22.23.5, ^24.22.3 or >=26.13.1; Payload and its UI/translation packages >=3.94.1 <4; React and React DOM ^19.3.1; and @sanity/client >=6 <9.
Automatic cleanup requires Payload's PostgreSQL adapter. deleteSanityAssets defaults to true; use a dedicated dataset and coordinate writers through this plugin. Set deleteSanityAssets: false when asset ownership is shared or uncertain. Keep the Sanity write token on the server.
import { sanityStorage } from '@klnap/payload-storage-sanity'
sanityStorage({
projectId: process.env.SANITY_PROJECT_ID!,
dataset: process.env.SANITY_DATASET!,
token: process.env.SANITY_API_TOKEN!,
collections: { media: true },
})
Add the plugin to an existing Payload configuration and upload collection. Configure @payloadcms/db-postgres in the host app when automatic cleanup is enabled. See operations before enabling deletion or upgrading an existing schema.
The framework-neutral @klnap/payload-storage-sanity/consumers entry exports asset types and URL helpers. The optional @klnap/payload-storage-sanity/consumers/next entry provides SanityImage, SanityVideo and SanityImageOrVideo. Image consumers need Next.js >=16.4.5 <17. Video consumers also need next-video >=2.8 <3 and player.style >=0.3 <1; storage-only and image-only consumers do not need those video peers.
import { SanityImage, SanityVideo, SanityImageOrVideo } from '@klnap/payload-storage-sanity/consumers/next'
<SanityImage asset={image} sizes="100vw" />
<SanityVideo asset={video} preload="none" controls />
<SanityImageOrVideo asset={media} fill sizes="(max-width: 768px) 100vw, 33vw" video={{ mode: 'background' }} />
See frontend usage for responsive images, poster configuration, crop and focal positioning, and loading behavior.
Sanity and PostgreSQL do not share an atomic transaction. Cleanup is recorded in the Payload transaction and runs after commit. Unknown remote deletion outcomes fail closed until an operator has positive evidence to resolve the exact outbox record; see the recovery procedure.
Sanity CDN URLs are publicly fetchable by anyone who knows them, including URLs from private datasets. Payload access rules do not make a direct CDN URL private. Standard Sanity video assets are files, not adaptive streams; playback depends on browser codec support.
Images use Next.js responsive selection with Sanity CDN transformations. Video preload and poster loading are independent. See the measured frontend observations; laboratory results are not field Web Vitals or universal guarantees.
This package is ESM. Browser-side media preparation is an Admin convenience, not a server-side validation boundary. See the security policy, changelog and MIT license.
Topics
payload storage bunny
Storage adapter for with video streaming, signed URLs and CDN cache purging
753.9k/wk60v4
sirv payload
Use Sirv as a media source in the Payload admin and render assets on the frontend with @sirv/react
250v?
cloud storage
Store Payload uploads in third-party cloud storage through a generic adapter interface
1001.0M/wk46.1kv3 v4
payloadcms plugin image optimizer
Client-side resize, ThumbHash blur placeholders, filename strategies and bulk regeneration on top of Payload's sharp…
79666/wk27v3
payload plugin aspect preview
Live multi-aspect-ratio previews with crop and focal point editing for Payload upload collections
78174/wk6v3
image framing
Non-destructive crop and focus areas for Payload uploads, with per-usage overrides and responsive framing
6080/wk2v3