The Vercel KV database adapter allows you to use the Vercel KV database with Tina. This adapter uses the Upstash Redis client, allowing it to also work with Upstash Redis as well.

Looking for the code? Check out the GitHub repository.

To get started, you will need to set up some environment variables.

First copy your values from the Vercel or Upstash dashboard.

Vercel Dashboard

Then add the following environment variables to your project:

KV_REST_API_URL=***
KV_REST_API_TOKEN=***

Create the database adapter

//...
import { RedisLevel } from 'upstash-redis-level'
export default isLocal
? createLocalDatabase()
: createDatabase({
// ...
databaseAdapter: new RedisLevel({
namespace: branch,
redis: {
url: process.env.KV_REST_API_URL || 'http://localhost:8079',
token: process.env.KV_REST_API_TOKEN || 'example_token',
},
debug: process.env.DEBUG === 'true' || false,
}),
})
Last Edited: January 1, 1970
Table of Contents