Skip to content
Back to search

keyv

Simple key-value storage with support for multiple backends

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/jaredwray/keyv with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/jaredwray/keyv'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/jaredwray--keyv/badge.svg)](/listings/jaredwray--keyv)

HTML

<a href="/listings/jaredwray--keyv"><img src="/api/listings/jaredwray--keyv/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Keyv provides a consistent interface for key-value storage across multiple backends via storage adapters. It supports TTL-based expiry, making it suitable as a cache or a persistent key-value store.

Install Keyv:

npm install keyv

By default everything is stored in memory. You can optionally install a storage adapter for persistent backends:

npm install @keyv/redis

Use it:

import Keyv from 'keyv';

const keyv = new Keyv();
await keyv.set('foo', 'bar');
await keyv.get('foo'); // 'bar'

For the full API documentation, see the [Keyv README](https://github.com/jaredwray/keyv/blob/main/core/keyv/README.md).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 125 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <h1 align="center"><img width="250" src="https://jaredwray.com/images/keyv.svg" alt="keyv"></h1>
  2. > Simple key-value storage with support for multiple backends
  3. [![build](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
  4. [![bun](https://github.com/jaredwray/keyv/actions/workflows/bun-test.yaml/badge.svg)](https://github.com/jaredwray/keyv/actions/workflows/bun-test.yaml)
  5. [![browser](https://github.com/jaredwray/keyv/actions/workflows/browser-compat.yaml/badge.svg)](https://github.com/jaredwray/keyv/actions/workflows/browser-compat.yaml)
  6. [![](https://data.jsdelivr.com/v1/package/npm/keyv/badge)](https://www.jsdelivr.com/package/npm/keyv)
  7. [![codecov](https://codecov.io/gh/jaredwray/keyv/graph/badge.svg?token=bRzR3RyOXZ)](https://codecov.io/gh/jaredwray/keyv)
  8. [![npm](https://img.shields.io/npm/dm/keyv.svg)](https://www.npmjs.com/package/keyv)
  9. [![npm](https://img.shields.io/npm/v/keyv.svg)](https://www.npmjs.com/package/keyv)
  10. # Getting Started
  11. Keyv provides a consistent interface for key-value storage across multiple backends via storage adapters. It supports TTL-based expiry, making it suitable as a cache or a persistent key-value store.
  12. Install Keyv:
  13. ```
  14. npm install keyv
  15. ```
  16. By default everything is stored in memory. You can optionally install a storage adapter for persistent backends:
  17. ```
  18. npm install @keyv/redis
  19. ```
  20. Use it:
  21. ```js
  22. import Keyv from 'keyv';
  23. const keyv = new Keyv();
  24. await keyv.set('foo', 'bar');
  25. await keyv.get('foo'); // 'bar'
  26. ```
  27. For the full API documentation, see the [Keyv README](https://github.com/jaredwray/keyv/blob/main/core/keyv/README.md).
  28. # Project Structure
  29. This monorepo is organized into categorized directories:
  30. ```
  31. core/ Core packages
  32. keyv/ Main Keyv library
  33. test-suite/ Shared test suite for API compliance
  34. bigmap/ Scalable in-memory Map
  35. serialization/ Serialization packages
  36. superjson/ SuperJSON serializer (@keyv/serialize-superjson)
  37. msgpackr/ MessagePack serializer (@keyv/serialize-msgpackr)
  38. compression/ Compression adapters
  39. compress-brotli/
  40. compress-gzip/
  41. compress-lz4/
  42. storage/ Storage adapters
  43. redis/ postgres/ mysql/ mongo/ sqlite/
  44. memcache/ etcd/ valkey/ valkey-glide/ dynamo/ cloudflare-kv/ fs/
  45. website/ Documentation website (keyv.org)
  46. ```
  47. # Packages
  48. * [keyv](https://github.com/jaredwray/keyv/tree/main/core/keyv) - Simple key-value storage with support for multiple backends
  49. * [test-suite](https://github.com/jaredwray/keyv/tree/main/core/test-suite) - Test suite for Keyv API compliance
  50. * [bigmap](https://github.com/jaredwray/keyv/tree/main/core/bigmap) - Scalable in-memory Map
  51. ## Storage Adapters
  52. * [cloudflare-kv](https://github.com/jaredwray/keyv/tree/main/storage/cloudflare-kv) - Cloudflare Workers KV storage adapter
  53. * [dynamo](https://github.com/jaredwray/keyv/tree/main/storage/dynamo) - DynamoDB storage adapter
  54. * [etcd](https://github.com/jaredwray/keyv/tree/main/storage/etcd) - Etcd storage adapter
  55. * [fs](https://github.com/jaredwray/keyv/tree/main/storage/fs) - File system storage adapter
  56. * [memcache](https://github.com/jaredwray/keyv/tree/main/storage/memcache) - Memcache storage adapter
  57. * [mongo](https://github.com/jaredwray/keyv/tree/main/storage/mongo) - MongoDB storage adapter
  58. * [mysql](https://github.com/jaredwray/keyv/tree/main/storage/mysql) - MySQL/MariaDB storage adapter
  59. * [postgres](https://github.com/jaredwray/keyv/tree/main/storage/postgres) - PostgreSQL storage adapter
  60. * [redis](https://github.com/jaredwray/keyv/tree/main/storage/redis) - Redis storage adapter
  61. * [sqlite](https://github.com/jaredwray/keyv/tree/main/storage/sqlite) - SQLite storage adapter
  62. * [valkey](https://github.com/jaredwray/keyv/tree/main/storage/valkey) - Valkey (Open Source Redis) storage adapter
  63. * [valkey-glide](https://github.com/jaredwray/keyv/tree/main/storage/valkey-glide) - Valkey GLIDE storage adapter
  64. ## Compression Adapters
  65. * [compress-brotli](https://github.com/jaredwray/keyv/tree/main/compression/compress-brotli) - Brotli compression adapter
  66. * [compress-gzip](https://github.com/jaredwray/keyv/tree/main/compression/compress-gzip) - Gzip compression adapter
  67. * [compress-lz4](https://github.com/jaredwray/keyv/tree/main/compression/compress-lz4) - LZ4 compression adapter
  68. ## Serialization
  69. The default serializer (`KeyvJsonSerializer`) is built into the core `keyv` package. Alternative serializers are available as separate packages:
  70. * [serialize-superjson](https://github.com/jaredwray/keyv/tree/main/serialization/superjson) - SuperJSON serializer with Date, Map, Set, BigInt support (@keyv/serialize-superjson)
  71. * [serialize-msgpackr](https://github.com/jaredwray/keyv/tree/main/serialization/msgpackr) - High-performance MessagePack serializer (@keyv/serialize-msgpackr)
  72. ## Third-party Storage Adapters
  73. We love the community and the third-party storage adapters they have built. They enable Keyv to be used with even more backends and use cases.
  74. View the complete list of third-party storage adapters and learn how to build your own at https://keyv.org/docs/storage-adapters/third-party/
  75. # Contributing
  76. We welcome contributions! Here are some ways to get involved:
  77. * **Pull Requests** - Fork the repo, make your changes, run `pnpm test`, and open a PR. See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed instructions.
  78. * **Issues** - Report bugs or request features by [opening an issue](https://github.com/jaredwray/keyv/issues). For bugs, include replication steps and error messages.
  79. * **Questions** - Create an issue with the label "question" and include relevant context.
  80. * **Storage Adapter Requests** - Create an issue with the label "storage adapter." Requests are given 30-60 days for community interest before being triaged.
  81. * **Security** - See our [security policy](https://github.com/jaredwray/keyv/blob/main/SECURITY.md) for reporting vulnerabilities.
  82. * **Code of Conduct** - Please review our [Code of Conduct](CODE_OF_CONDUCT.md).
  83. # Keyv v5 to v6
  84. Keyv v6 is the current stable release, starting with 6.1.0. It includes several major changes such as improved TypeScript support, enhanced hooks system, and streamlined storage adapter interfaces. See the full migration guide at https://keyv.org/docs/migration/v5-to-v6/ (coming from v4? start with https://keyv.org/docs/migration/v4-to-v5/).
  85. Using an AI coding agent? Tell it: *"Upgrade this project to Keyv v6 using https://keyv.org/skills/migrate"*. The migration skill lives in [skills/keyv-migrate](skills/keyv-migrate/SKILL.md) and can also be installed with `npx skills add jaredwray/keyv --skill keyv-migrate`.
  86. The previous documentation site is archived at https://keyv.org/v5/.
  87. No major functionality will be added to Keyv v5. Only maintenance and security fixes will be applied going forward.
  88. # License
  89. [MIT © Jared Wray](./LICENSE)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.