{"id":19425533,"url":"https://github.com/hendrysadrak/firestore-store","last_synced_at":"2025-08-02T17:11:31.928Z","repository":{"id":30510120,"uuid":"125179157","full_name":"hendrysadrak/firestore-store","owner":"hendrysadrak","description":"express-session store for Firebase Cloud Firestore","archived":false,"fork":false,"pushed_at":"2023-12-11T11:49:11.000Z","size":696,"stargazers_count":49,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T05:00:19.030Z","etag":null,"topics":["connect","express","express-session","expressjs","firebase","firestore","firestore-store","nodejs"],"latest_commit_sha":null,"homepage":"https://npm.im/firestore-store","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hendrysadrak.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T08:22:21.000Z","updated_at":"2025-02-24T06:20:59.000Z","dependencies_parsed_at":"2024-06-19T00:20:26.080Z","dependency_job_id":"67aa92f5-7038-4d54-809c-fe9e2df9516e","html_url":"https://github.com/hendrysadrak/firestore-store","commit_stats":{"total_commits":127,"total_committers":5,"mean_commits":25.4,"dds":"0.25984251968503935","last_synced_commit":"b84fe6e417688382125063dbad956b7a81643206"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/hendrysadrak/firestore-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrysadrak%2Ffirestore-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrysadrak%2Ffirestore-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrysadrak%2Ffirestore-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrysadrak%2Ffirestore-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hendrysadrak","download_url":"https://codeload.github.com/hendrysadrak/firestore-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrysadrak%2Ffirestore-store/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268424029,"owners_count":24248119,"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-02T02:00:12.353Z","response_time":74,"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":["connect","express","express-session","expressjs","firebase","firestore","firestore-store","nodejs"],"created_at":"2024-11-10T14:03:55.360Z","updated_at":"2025-08-02T17:11:31.900Z","avatar_url":"https://github.com/hendrysadrak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# firestore-store [![Build Status](https://travis-ci.org/hendrysadrak/firestore-store.svg?branch=master)](https://travis-ci.org/hendrysadrak/firestore-store)\n\n**Firestore session store for Express.js / Connect.**\n\nSource of this library is written in **ES6** but commonjs exports are used. If you have any problems or questions let me know in [issues](https://github.com/hendrysadrak/firestore-store/issues).\n\n- [Installation](#installation)\n- [Usage](#usage-with-expressjs--connect)\n- [Options](#options)\n- [Compatibility](#compatibility)\n- [Changelog](https://github.com/hendrysadrak/firestore-store/releases)\n- [Examples](/examples)\n- [Support](#support)\n- [License](#license)\n\n## Installation\n\n`firebase-admin` is a required peer dependency for `firestore-store`.\n\n```bash\nnpm install firebase-admin firestore-store --save\n```\n\n## Usage with Express.js / Connect\n\nInitialize `firebase-admin` firestore database.\n\n```javascript\nconst admin = require(\"firebase-admin\");\n\nconst firebase = admin.initializeApp({\n\tcredential: admin.credential.cert(\"path/to/serviceAccountCredentials.json\"),\n\tdatabaseURL: \"https://\u003cDATABASE_URL\u003e.firebaseio.com\",\n});\n\nconst database = firebase.firestore();\n```\n\nPass `express-session` to `firestore-store`\n\n```javascript\nconst session = require(\"express-session\");\nconst FirestoreStore = require(\"firestore-store\")(session);\n```\n\nPass database reference to the FirestoreStore.\n\n```javascript\nexpress() // or connect\n\t.use(\n\t\tsession({\n\t\t\tstore: new FirestoreStore({\n\t\t\t\tdatabase: database,\n\t\t\t}),\n\n\t\t\tsecret: \"keyboard cat\",\n\t\t\tresave: true,\n\t\t\tsaveUninitialized: true,\n\t\t})\n\t);\n```\n\n## Usage in Cloud Functions or Cloud Run\n\nWhen using Firebase Hosting together with Cloud Functions or Cloud Run, cookies are stripped from incoming requests. This would normally prevent the session lookup mechanism from working. However, when using `__session` as the name, the value will be passed through to the app.\n\n```javascript\nexpress() // or connect\n\t.use(\n\t\tsession({\n\t\t\tstore: new FirestoreStore({\n\t\t\t\tdatabase: database,\n\t\t\t}),\n\n\t\t\tname: \"__session\", // ← required for Cloud Functions / Cloud Run\n\t\t\tsecret: \"keyboard cat\",\n\t\t\tresave: true,\n\t\t\tsaveUninitialized: true,\n\t\t})\n\t);\n```\n\nRefer to [Using Cookies in the Firebase Documentation on Caching](https://firebase.google.com/docs/hosting/manage-cache#using_cookies)\n\n## Options\n\n```javascript\nconst store = new FirestoreStore(options);\n```\n\n#### options.database (required)\n\nFirestore reference.\n\n#### options.collection (default: 'sessions', optional)\n\nCollection name to use for sessions.\n\n#### options.parser (default: DocParser, optional)\n\nParser used to save or read session info from session document. If you need custom functionality or want to add more properties you can implement such a parser yourself. Required is to have `read` and `save` methods. Check default parser [DocParser](lib/doc-parser.js)\n\n##### Example of a custom parser adding `dateModified` field:\n\n```javascript\nconst parser = {\n\tread(doc) {\n\t\treturn JSON.parse(doc.session);\n\t},\n\n\tsave(doc) {\n\t\treturn {\n\t\t\tsession: JSON.stringify(doc),\n\t\t\tdateModified: Date.now(),\n\t\t};\n\t},\n};\n\nconst store = new FirestoreStore({ parser });\n```\n\n##### Example of a custom parser storing the session in the firestore without stringifying:\n\n\u003e https://github.com/hendrysadrak/firestore-store/issues/57#issue-718419725\n\n```javascript\nconst parser = {\n\tread(doc) {\n\t\treturn doc;\n\t},\n\n\tsave(doc) {\n\t\treturn JSON.parse(JSON.stringify(doc));\n\t},\n};\n\nconst store = new FirestoreStore({ parser });\n```\n\n## Compatibility\n\nThis store implements all the **required, recommended and optional** [methods](https://github.com/expressjs/session#session-store-implementation) of the express-session store.\n\nCurrently tested with node.js version 10, 12 \u0026 14. Travis is used for running tests https://travis-ci.org/hendrysadrak/firestore-store\n\n## Support\n\nIf you have any problems or questions let me know in [issues](https://github.com/hendrysadrak/firestore-store/issues).\n\nIf you see it as a useful library star :star: it on [Github](https://github.com/hendrysadrak/firestore-store) so I know to put more time into supporting it.\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrysadrak%2Ffirestore-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhendrysadrak%2Ffirestore-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrysadrak%2Ffirestore-store/lists"}