{"id":30141766,"url":"https://github.com/solzimer/session-pouchdb-store","last_synced_at":"2025-08-11T05:17:47.219Z","repository":{"id":55865197,"uuid":"117665579","full_name":"solzimer/session-pouchdb-store","owner":"solzimer","description":"PouchDB express session store. Can do realtime session data synchronization via PouchDB server","archived":false,"fork":false,"pushed_at":"2022-12-07T11:56:21.000Z","size":222,"stargazers_count":5,"open_issues_count":6,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-03T15:39:56.102Z","etag":null,"topics":["couchdb","express","expressjs","middleware","pouchdb","realtime","session","store","synchronization"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solzimer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-16T09:52:56.000Z","updated_at":"2024-09-20T23:51:02.000Z","dependencies_parsed_at":"2023-01-23T17:00:16.584Z","dependency_job_id":null,"html_url":"https://github.com/solzimer/session-pouchdb-store","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/solzimer/session-pouchdb-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solzimer%2Fsession-pouchdb-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solzimer%2Fsession-pouchdb-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solzimer%2Fsession-pouchdb-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solzimer%2Fsession-pouchdb-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solzimer","download_url":"https://codeload.github.com/solzimer/session-pouchdb-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solzimer%2Fsession-pouchdb-store/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269833310,"owners_count":24482423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["couchdb","express","expressjs","middleware","pouchdb","realtime","session","store","synchronization"],"created_at":"2025-08-11T05:17:46.077Z","updated_at":"2025-08-11T05:17:47.202Z","avatar_url":"https://github.com/solzimer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# session-pouchdb-store\n\nA [PouchDB](https://pouchdb.com/) session store for [express.js](http://expressjs.com/).\n\n[![Build Status](https://travis-ci.org/solzimer/session-pouchdb-store.svg?branch=master)](https://travis-ci.org/solzimer/session-pouchdb-store)\n\n## Features\n* Compatible with PouchDB and CouchDB (or any database that uses the CouchDB API).\n* Realtime session data synchronization between processes (if PouchDB/CouchDB server is used)\n* Default in-memory PouchDB instance.\n* Custom PouchDB instance.\n* Scavenge and purge invalid/expired sessions.\n\n## Installation\n```\nnpm install session-pouchdb-store --save\n```\nThis will install `session-pouchdb-store` and add it to your application's `package.json` file.\n\n\n## Important Notes\n\nIf you use a remote PouchDB server, make sure the database exists prior to start your application/s\n\n## Basic Usage\n\nUse with your express session middleware, like this:\n```js\nconst\n\texpress = require(\"express\"),\n\tsession = require(\"express-session\"),\n\tPouchSession = require(\"session-pouchdb-store\");\n\nlet app = express();\n\napp.use(session({\n  secret: 'thisismysecret',\n  resave: false,\n  saveUninitialized: true,\n\tstore : new PouchSession()\n}));\n\napp.listen(3000, () =\u003e {\n\tconsole.log(`Server ${process.pid} started on port 3000`);\n});\n```\nBy default, PouchSession creates an in-memory database for testing purposes. You can pass your own instance or connect to a remote PouchDB/CouchDB server:\n\n### Remote PouchDB server\n```js\napp.use(session({\n  secret: 'thisismysecret',\n  resave: false,\n  saveUninitialized: true,\n\tstore : new PouchSession('http://pouchdbserver:port/sessions')\n}));\n```\n\n### Custom instance\n```js\nconst PouchDB = require('pouchdb');\n\nlet db = new PouchDB(\"sessions\",{adapter:'leveldb'});\napp.use(session({\n  secret: 'thisismysecret',\n  resave: false,\n  saveUninitialized: true,\n\tstore : new PouchSession(db)\n}));\n```\n### Realtime synchronization\nIn order to synchronize session data, the current version of the store requires a remote PouchDB server, so multiple express processes can connect to the same database and perform synchronization.\n\n## API\n### new PouchSession(pouchInstance, options)\nCreates a new store instance. The first argument can be one of the following:\n* **undefined** If no arguments is passed, a default in-memory instance is created.\n* **PouchDB instance** The PouchDB instance that will be used by the store.\n* **URL string** A URL string to a remote PouchDB/CouchDB server.\n* **string** A simple string is used as a file path for leveldb storage\n\nOptions is an object that allows overriding some store behaviours:\n* **maxIdle** Max time in ms a session can go idle. When this time exceeds, the session is remove from the store cache. Note that a session can be idle and still be a valid session; session expiration is defined by the express-session module. The purpose of this parameter is to release from memory sessions that are not being used.\n* **scavenge** Interval time in ms that the store will search and release *maxIdle* sessions.\n* **purge** Interval time in ms that the the store will remove expired sessions from the database.\n\nDefault options are as follows:\n\nHere is a list of all available options:\n```js\nvar options = {\n\t// Max idle time in ms\n\tmaxIdle : 5*60*1000,\n\t// Scavenge period in ms\n\tscavenge : 1000,\n\t// Database purge period in ms\t\t\t\t\t\n\tpurge : 5*60*1000\t\t\t\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolzimer%2Fsession-pouchdb-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolzimer%2Fsession-pouchdb-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolzimer%2Fsession-pouchdb-store/lists"}