https://github.com/rubix-studios-pty-ltd/payload-upstash
This package provides a way to use Upstash Redis as a KV adapter with Payload.
https://github.com/rubix-studios-pty-ltd/payload-upstash
kv-store payload payload-plugin payloadcms payloadcms-v3 redis upstash upstash-redis
Last synced: 4 months ago
JSON representation
This package provides a way to use Upstash Redis as a KV adapter with Payload.
- Host: GitHub
- URL: https://github.com/rubix-studios-pty-ltd/payload-upstash
- Owner: rubix-studios-pty-ltd
- License: mit
- Created: 2026-01-13T04:41:19.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-06T16:52:30.000Z (4 months ago)
- Last Synced: 2026-02-07T00:45:43.684Z (4 months ago)
- Topics: kv-store, payload, payload-plugin, payloadcms, payloadcms-v3, redis, upstash, upstash-redis
- Language: TypeScript
- Homepage: https://rubixstudios.com.au
- Size: 391 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# PayloadCMS + Upstash KV Adapter
This package provides a way to use [Upstash](https://upstash.com) as a KV adapter with Payload.
## Installation
```sh
pnpm add @rubixstudios/payload-upstash
```
## Usage
```ts
import { upstashKVAdapter } from '@rubixstudios/payload-upstash'
export default buildConfig({
collections: [Media],
kv: upstashKVAdapter({
// Upstash connection URL. Defaults to process.env.UPSTASH_URL
url: process.env.UPSTASH_URL!,
token: process.env.UPSTASH_TOKEN!,
// Optional prefix for Upstash Redis keys to isolate the store. Defaults to 'payload-kv:'
keyPrefix: 'kv-storage:',
// Optional TTL configuration for automatic expiration by key prefix
ttl: [
{ prefix: 'session:', ttl: 3600 },
{ prefix: 'cache:', ttl: 300 },
{ prefix: 'temp:', ttl: 60 },
],
}),
})
```
Then you can access the KV storage using `payload.kv`:
```ts
await payload.kv.set('key', { value: 1 })
const data = await payload.kv.get('key')
payload.logger.info(data)
```