{"id":18712212,"url":"https://github.com/fobo66/algolia-firebase-functions","last_synced_at":"2025-06-17T10:41:00.945Z","repository":{"id":38375101,"uuid":"96042975","full_name":"fobo66/algolia-firebase-functions","owner":"fobo66","description":"Firebase Cloud Functions for sync Firebase Database or Firestore with Algolia in real time","archived":false,"fork":false,"pushed_at":"2025-06-10T12:37:56.000Z","size":6918,"stargazers_count":32,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-10T12:39:51.515Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://fobo66.github.io/algolia-firebase-functions/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fobo66.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2017-07-02T18:56:27.000Z","updated_at":"2025-06-10T12:38:47.000Z","dependencies_parsed_at":"2024-11-06T20:25:47.937Z","dependency_job_id":"4eda6906-3437-4d8c-a877-66a7a6ede9df","html_url":"https://github.com/fobo66/algolia-firebase-functions","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/fobo66/algolia-firebase-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fobo66%2Falgolia-firebase-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fobo66%2Falgolia-firebase-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fobo66%2Falgolia-firebase-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fobo66%2Falgolia-firebase-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fobo66","download_url":"https://codeload.github.com/fobo66/algolia-firebase-functions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fobo66%2Falgolia-firebase-functions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260342277,"owners_count":22994795,"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","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":[],"created_at":"2024-11-07T12:40:55.047Z","updated_at":"2025-06-17T10:40:55.925Z","avatar_url":"https://github.com/fobo66.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Community Integrations"],"sub_categories":[],"readme":"# Algolia \u003c-\u003e Firebase cloud functions\n\n[![npm](https://img.shields.io/npm/v/algolia-firebase-functions.svg)](https://www.npmjs.com/package/algolia-firebase-functions)\n![Tests](https://github.com/fobo66/algolia-firebase-functions/workflows/Tests/badge.svg)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e0db542266204846b3a47018839453f4)](https://www.codacy.com/manual/fobo66/algolia-firebase-functions?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=fobo66/algolia-firebase-functions\u0026amp;utm_campaign=Badge_Grade)\n\nUseful library to keep your [Firebase Database](https://firebase.google.com/docs/database) of [Firebase Cloud Firestore](https://firebase.google.com/docs/firestore) data in sync with [Algolia](https://algolia.com) for easy search.\n\nStarting from version 2.0, this library supports Cloud Functions v1.0. If you need to support beta Cloud Functions, use version 1.0.3 instead.\n\nStarting from version 4.0.0, this library supports Node \u003e= 10 and no longer supports Node 8. If you still need to support Node 8, use version 3.3.0 instead.\n\nStarting from version 4.1.2, this library supports only ES6 modules or Typescript.\n\nStarting from version 5.0.0, this library supports Node \u003e= 14 and no longer supports Node 10 and 12. If you still need to support Node 10 or 12, use version 4.1.2 instead.\n\nStarting from version 6.0.0, this library uses Algolia SDK v5.\n\n## Installation\n\nIn your `functions` directory:\n\n``` bash\n npm install --save algolia-firebase-functions\n```\n\n## Usage\n\nTo use this library in your Functions, first of all you need to set environmental variables for Algolia to initialize connection. Grab your API keys [here](https://algolia.com/dashboard) first.\n\nOpen Terminal, go to your `functions` directory and input these commands:\n\n``` bash\nfirebase functions:config:set algolia.app=\"\u003cYOUR-ALGOLIA-APP-ID\u003e\"\nfirebase functions:config:set algolia.key=\"\u003cYOUR-ALGOLIA-APP-PUBLIC-KEY\u003e\"\nfirebase functions:config:set algolia.index=\"\u003cYOUR-ALGOLIA-INDEX-NAME\u003e\"\n```\n\nThen, in your functions' `index.js` file, paste the following lines:\n\n``` js\nimport { config, database } from 'firebase-functions';\nimport admin from 'firebase-admin';\nimport { searchClient } from \"@algolia/client-search\";\nimport { syncAlgoliaWithFirebase } from 'algolia-firebase-functions';\n\nadmin.initializeApp(config().firebase);\nconst algolia = searchClient(functions.config().algolia.app,\n                              functions.config().algolia.key);\nconst index = functions.config().algolia.index;\n\n\nexport const syncAlgoliaFunction = database.ref('/myRef/{childRef}').onWrite(\n   (change, context) =\u003e syncAlgoliaWithFirebase(algolia, index, change)\n)\n\n```\n\nIf you're using [Firebase Cloud Firestore](https://firebase.google.com/docs/firestore/), you can use the following code:\n\n```js\nimport { firestore } from 'firebase-functions';\nimport { syncAlgoliaWithFirestore } from 'algolia-firebase-functions';\n\nexport const syncAlgoliaFunction = firestore.document('/myDocument/{childDocument}').onWrite(\n   (change, context) =\u003e syncAlgoliaWithFirestore(algolia, index, change);\n);\n```\n\nAnd redeploy your functions:\n\n```bash\nfirebase deploy --only functions\n```\n\nNow, after any changes made with your references, it will be sent to Algolia, so you'll be sure that users can search on the newest data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffobo66%2Falgolia-firebase-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffobo66%2Falgolia-firebase-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffobo66%2Falgolia-firebase-functions/lists"}