# @keyv/sqlite

> SQLite storage adapter for Keyv

Latest version **4.0.8** (published 2026-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @keyv/sqlite
pnpm add @keyv/sqlite
yarn add @keyv/sqlite
bun add @keyv/sqlite
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.8 |
| Published | 2026-01-21 |
| First published | 2017-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 1 |
| Unpacked size | 19.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3200 |
| Author | Jared Wray |
| Maintainers | jaredwray |
| Keywords | sqlite, sql, keyv, storage, adapter, key, value, store, cache, ttl |

## Links

- npm: https://www.npmjs.com/package/@keyv/sqlite
- Repository: https://github.com/jaredwray/keyv
- Issues: https://github.com/jaredwray/keyv/issues
- npm.io page: https://npm.io/package/@keyv/sqlite

## Dependencies (1)

- [sqlite3](https://npm.io/package/sqlite3.md) ^5.1.7

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 4.0.8 (latest) — 2026-01-21
- 6.0.0-rc.1 (rc) — 2026-08-03
- 6.0.0-beta.4 (beta) — 2026-06-18
- 6.0.0-alpha.3 (alpha) — 2026-03-22
- 6.0.0-beta.3 — 2026-06-11
- 6.0.0-alpha.2 — 2026-03-04
- 6.0.0-alpha.1 — 2026-02-26
- 4.0.6 — 2025-10-10
- 4.0.5 — 2025-06-21
- 4.0.4 — 2025-05-17
- 4.0.3 — 2025-04-20
- 4.0.2 — 2025-04-05
- 4.0.1 — 2024-08-21
- 4.0.0 — 2024-08-20
- 3.6.7 — 2024-01-20
- … 27 more at https://npm.io/package/@keyv/sqlite/versions

## README

# @keyv/sqlite [<img width="100" align="right" src="https://jaredwray.com/images/keyv-symbol.svg" alt="keyv">](https://github.com/jaredwra/keyv)

> SQLite storage adapter for Keyv

[![build](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
[![codecov](https://codecov.io/gh/jaredwray/keyv/branch/main/graph/badge.svg?token=bRzR3RyOXZ)](https://codecov.io/gh/jaredwray/keyv)
[![npm](https://img.shields.io/npm/v/@keyv/sqlite.svg)](https://www.npmjs.com/package/@keyv/sqlite)
[![npm](https://img.shields.io/npm/dm/@keyv/sqlite)](https://npmjs.com/package/@keyv/sqlite)

SQLite storage adapter for [Keyv](https://github.com/lukechilds/keyv).

## Install

```shell
npm install --save keyv @keyv/sqlite
```

## Usage

```js
import Keyv from 'keyv';
import KeyvSqlite from '@keyv/sqlite';

const keyv = new Keyv(new KeyvSqlite('sqlite://path/to/database.sqlite'));
keyv.on('error', handleConnectionError);
```

You can specify the `table` and [`busyTimeout`](https://sqlite.org/c3ref/busy_timeout.html) option.

e.g:

```js
import Keyv from 'keyv';
import KeyvSqlite from '@keyv/sqlite';

const keyvSqlite = new KeyvSqlite('sqlite://path/to/database.sqlite', {
  table: 'cache',
  busyTimeout: 10000
});

const keyv = new Keyv({ store: keyvSqlite }); 
```

You can also use a helper function to create `Keyv` with `KeyvSqlite` store.

```js
import {createKeyv} from '@keyv/sqlite';

const keyv = createKeyv('sqlite://path/to/database.sqlite');
```


## License

[MIT © Jared Wray](LICENCE)

---
_Source: https://npm.io/package/@keyv/sqlite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
