npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prisma-vercel-kv

v1.0.4

Published

An extension for Prisma that caches query results to Vercel KV

Readme

prisma-vercel-kv Extension for Prisma Client

prisma-vercel-kv is an npm package that enhances Prisma Client by adding caching capabilities with Vercel KV as the storage solution. It provides a simple and efficient way to cache database read operations and invalidate them when writes occur, thereby optimizing the performance of your applications.

Features

  • Read Operation Caching: Caches the results of read operations to reduce database load.
  • Write Operation Cache Invalidation: Automatically invalidates cache upon any write operation to maintain data integrity.
  • Environment-based TTL Configuration: Easily configure cache expiration through environment variables.
  • Seamless Vercel KV Integration: Built to integrate effortlessly with Vercel's distributed key-value store.

Installation

Install prisma-vercel-kv by running the following command in your project:

npm install prisma-vercel-kv

Ensure that you have Prisma Client set up in your project, as prisma-vercel-kv is designed to extend its functionality. Also make sure you have Vercel KV installed, and the appropriate .env vars set up in your project for authentication.

Usage

Create an extended Prisma Client instance with prisma-vercel-kv to leverage caching in your database operations.

Creating an Extended Client

import { PrismaClient } from '@prisma/client';
import { PrismaVercelKV } from 'prisma-vercel-kv';

const prisma = new PrismaClient();

const prismaWithKV = prisma.$extends(PrismaVercelKV);

Performing Queries with Caching

With the extended client, perform your queries as usual, and prisma-vercel-kv will handle caching:

// Cached read operation
const users = await prismaWithKV.user.findMany();

// Write operation that triggers cache invalidation
await prismaWithKV.user.create({
  data: { name: 'Dana', email: '[email protected]' },
});

Cache Invalidation

prisma-vercel-kv ensures that the cache is invalidated appropriately after write operations to guarantee that subsequent reads fetch the latest data.

Configuration

To set the Time-To-Live (TTL) for cache entries, define PRISMA_VERCEL_KV_TTL in your .env file:

# .env
PRISMA_VERCEL_KV_TTL=86400 # TTL in seconds, e.g., 86400 for 24 hours

Adjust the TTL according to your application's caching requirements. It is set to 3600 by default.

Limitations

  • Assumes JSON-compatible serialization of cached data.
  • Does not support nested operations within the query extension type.
  • Broad cache invalidation may affect more cache entries than necessary for certain types of write operations.

Contributing

We welcome contributions to prisma-vercel-kv. Visit the GitHub repository to report issues, suggest features, or make pull requests.

License

prisma-vercel-kv is available under the MIT License. Refer to the LICENSE file in the GitHub repository for detailed information.


For comprehensive guidance on Prisma Client extensions, consult the Prisma documentation.