# connect-sqlite3

> SQLite3 session store for Connect

Latest version **0.9.18** (published 2026-08-06) · 0 weekly downloads

## Install

```sh
npm install connect-sqlite3
pnpm add connect-sqlite3
yarn add connect-sqlite3
bun add connect-sqlite3
```

## Health

**Score 58/100 (C)** — status: active.

Positive: has types package; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.9.18 |
| Published | 2026-08-06 |
| First published | 2012-09-10 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/connect-sqlite3) |
| Module format | CommonJS |
| Node | >=0.4.x |
| Dependencies | 0 |
| Unpacked size | 105.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | David Feinberg |
| Maintainers | bergstyle |

## Links

- npm: https://www.npmjs.com/package/connect-sqlite3
- Repository: https://github.com/rawberg/connect-sqlite3
- Homepage: https://github.com/rawberg/connect-sqlite3#readme
- Issues: https://github.com/rawberg/connect-sqlite3/issues
- npm.io page: https://npm.io/package/connect-sqlite3

## Recent versions

- 0.9.18 (latest) — 2026-08-06
- 0.9.17 — 2026-07-13
- 0.9.16 — 2025-06-22
- 0.9.15 — 2024-03-11
- 0.9.13 — 2021-11-30
- 0.9.12 — 2021-08-14
- 0.9.11 — 2018-04-27
- 0.9.10 — 2017-08-08
- 0.9.9 — 2017-01-01
- 0.9.8 — 2016-03-13
- 0.9.7 — 2016-01-24
- 0.9.6 — 2015-11-21
- 0.9.5 — 2015-03-21
- 0.9.4 — 2015-01-11
- 0.9.3 — 2014-05-13
- … 4 more at https://npm.io/package/connect-sqlite3/versions

## README

# Connect SQLite3

connect-sqlite3 is a SQLite3 session store modeled after the TJ's connect-redis store.


## Installation
```sh
	  $ npm install connect-sqlite3
```

## Options

  - `table='sessions'` Database table name
  - `db='sessionsDB'` Database file name (defaults to table name), OR an already-initialized sqlite3 database connection object
  - `dir='.'` Directory to save the `'<db>'` file in (only used when `db` is a filename)
  - `createDirIfNotExists='false'` Directory `dir` is created recursively if it doesn't exist (only used when `db` is a filename)
  - `concurrentDB='false'` Enables [WAL](https://www.sqlite.org/wal.html) mode (defaults to false)

`db` can be either a filename, in which case connect-sqlite3 opens (and creates, if needed) the database itself using [`sqlite3`](https://www.npmjs.com/package/sqlite3) — install it with `npm install sqlite3` if it isn't already a dependency of your project — or an already-initialized database connection object, in which case your application is responsible for creating and managing that connection.

## Usage
```js
    var connect = require('connect'),
        SQLiteStore = require('connect-sqlite3')(connect);

    connect.createServer(
      connect.cookieParser(),
      connect.session({ store: new SQLiteStore, secret: 'your secret' })
    );
```
  with express
```js
    3.x:
    var SQLiteStore = require('connect-sqlite3')(express);

    4.x:
    var session = require('express-session');
    var SQLiteStore = require('connect-sqlite3')(session);

    app.configure(function() {
      app.set('views', __dirname + '/views');
      app.set('view engine', 'ejs');
      app.use(express.bodyParser());
      app.use(express.methodOverride());
      app.use(express.cookieParser());
      app.use(session({
        store: new SQLiteStore,
        secret: 'your secret',
        cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 } // 1 week
      }));
      app.use(app.router);
      app.use(express.static(__dirname + '/public'));
    });
```
  or pass an already-initialized database connection instead of a filename, if you'd rather manage the connection yourself (this also lets you skip the `sqlite3` dependency in favor of a different driver, as long as it exposes the same `run`/`get`/`all`/`exec` methods):
```js
    var session = require('express-session'),
        sqlite3 = require('sqlite3'),
        SQLiteStore = require('connect-sqlite3')(session);

    var dbConnection = new sqlite3.Database('./sessions.db');

    app.use(session({
      store: new SQLiteStore({ db: dbConnection }),
      secret: 'your secret'
    }));
```
## Test
```sh
    $ npm test
```

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