1 min read

Vercel KV

Vercel KV is a durable Redis database that enables you to store and retrieve JSON data.
Table of Contents

Vercel KV is available on Hobby and Pro plans

Vercel KV provides durable, serverless Redis storage. KV has been designed to be fast, scalable, and secure, and it's a great choice for storing and retrieving key-value and JSON data in your apps.

KV stores are single region by default, but can be replicated to multiple regions for distributed workloads. Learn how Vercel KV works.

The following are just a few use cases for Vercel KV:

Ecommerce carts: Vercel KV can persist user session data across multiple page requests, enabling you to keep track of items in a shopping cart

Rate limiting: Key-value stores with fast reads and writes work well for rate-limiting traffic to prevent malicious activity, such as DDoS attacks or unintended traffic

Read the Vercel KV quickstart or deploy a template with Vercel KV preconfigured. Learn more about the KV SDK.

By default, a single Redis database is provisioned in the primary region you specify when you create a KV database. This primary region is where write operations will be routed.

A KV database may have additional read regions, and read operations will be run in the nearest region to the request that triggers them. This will result in lower latency reads for users close to your replicas.

Vercel KV is powered by a partnership with Upstash. This means:

  • Creating, deleting, and managing KV happens in the Vercel dashboard
  • You do not need to create an Upstash account to use Vercel KV

Here are some important points to note about how you can use Vercel KV with your workflow on Vercel:

  • You can use Vercel KV with any Redis client you prefer
  • You can have multiple Vercel KV database per account, depending on your plan, as explained in our KV Limits docs
  • You can use multiple Vercel KV database in one project
  • You can connect multiple projects to a single Vercel KV database
  • You can send Redis commands to your KV database without connecting it to your project. All you need are the API URL and appropriate token, which you can find on the dashboard. You can add them with the createClient method if you're using the SDK
  • Vercel KV database can be scoped to different environments within projects using Environment Variables
  • Vercel KV should be used in server environments, like Vercel Functions, versus from the browser. An API token, either set as an Environment Variable or added with the createClient method, is required to read and write to a database

You can import/export your Redis database using the upstash-redis-dump tool. Learn more about importing and exporting data.

To learn more about Vercel KV limitations, see KV Limits.

Last updated on April 23, 2024