# connect-remote

> Connect session store whose storage is through remote REST API

Latest version **3.1.0** (published 2026-10-22) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2026-10-22 |
| First published | 2022-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Ken Chen |
| Maintainers | chengusky |

## Links

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

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.20.0

## Recent versions

- 3.1.0 (latest) — 2026-10-22
- 3.0.0 — 2025-08-14
- 2.0.0 — 2022-08-11
- 1.1.0 — 2022-05-18

## README

**connect-remote** is a session store backed by any compatbile remote RESTful API service.

Setup
-----

```sh
npm install connect-remote express-session
```

Pass the `express-session` store into `connect-remote` to create a `RemoteStore` constructor.

```js
var session = require('express-session');
var RemoteStore = require('connect-remote')(session);

app.use(session({
    store: new RedisStore(options),
    secret: 'keyboard cat',
    resave: false
}));
```

Options
-------

A compatbile remote RESTful API URI is required. It is passed directly using the `uri` param.

- `uri` Remote service uri

The following additional params may be included:

-	`timeout` Value used for *timeout* option in [Request](https://github.com/request/request) (defaults to 100).


Compatbile remote RESTful API service
-----

This stores implement below functions:

* `destroy`: By `DELETE` method agasint uri `${uri}/${session_id}`.  
* `get`: By `GET` method agasint uri `${uri}/${session_id}`.  
* `set`: By `PUT` method agasint uri `${uri}/${session_id}` with session data as request body.  
* `all`: By `GET` method agasint uri `${uri}/`.  
* `clear`: By `DELETE` method agasint uri `${uri}/`.  
* `length`: By `GET` method agasint uri `${uri}/count`.  
* `touch`: By `POST` method agasint uri `${uri}/${session_id}` with session data as request body.  

All service response should be a JSON with `data` attribute that containing the result.  

```json
// RESTful API response sample for get method
{
    "data": {
        "cookie": {
            "originalMaxAge": 3600000,
            "expires": "2019-02-26T06:20:10.358Z",
            "httpOnly": true,
            "path": "/"
        }
    }
}

// RESTful API response sample for length method
{
    "data": 5
}
```

License
=======

MIT

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