{"id":28089277,"url":"https://github.com/deanc/gatsby-source-firestorer","last_synced_at":"2025-05-13T12:55:51.908Z","repository":{"id":46932868,"uuid":"230250884","full_name":"deanc/gatsby-source-firestorer","owner":"deanc","description":"Gatsby source plugin for building websites using the Firestore as a data source.","archived":false,"fork":false,"pushed_at":"2023-01-09T12:08:41.000Z","size":1384,"stargazers_count":4,"open_issues_count":11,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-27T14:49:09.353Z","etag":null,"topics":["firestore","gatsby","gatsby-plugin","gatsby-source"],"latest_commit_sha":null,"homepage":"","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/deanc.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":"2019-12-26T11:15:27.000Z","updated_at":"2020-11-15T20:19:05.000Z","dependencies_parsed_at":"2023-02-08T11:02:51.139Z","dependency_job_id":null,"html_url":"https://github.com/deanc/gatsby-source-firestorer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanc%2Fgatsby-source-firestorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanc%2Fgatsby-source-firestorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanc%2Fgatsby-source-firestorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deanc%2Fgatsby-source-firestorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deanc","download_url":"https://codeload.github.com/deanc/gatsby-source-firestorer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948335,"owners_count":21988953,"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":["firestore","gatsby","gatsby-plugin","gatsby-source"],"created_at":"2025-05-13T12:55:51.332Z","updated_at":"2025-05-13T12:55:51.888Z","avatar_url":"https://github.com/deanc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @deanc/gatsby-source-firestorer [![npm version](https://badge.fury.io/js/%40deanc%2Fgatsby-source-firestorer.svg)](https://badge.fury.io/js/%40deanc%2Fgatsby-source-firestorer)\n\nGatsby source plugin for building websites using the Firestore as a data source. Forked from a couple of other versions and updated to use\nlatest Gatsby params.\n\n# Authentication\n\nYou have two ways to authenticate to Firebase.\n\n1. (Recommended) Supply a valid firebaseConfig object with read-only credentials. [Instructions here](https://support.google.com/firebase/answer/7015592#web).\n2. Get a private key for your Firebase project from the Firebase console.\n\n# Usage\n\n## Method 1: Standard web SDK (Recommended)\n\n1. Supply a valid firebaseConfig object\n2. `$ yarn add @deanc/gatsby-source-firestorer`\n3. Configure `gatsby-config.js`\n\n```javascript\nmodule.exports = {\n  plugins: [\n    {\n      resolve: '@deanc/gatsby-source-firestorer',\n      options: {\n        config: {\n          apiKey: 'api-key',\n          authDomain: 'project-id.firebaseapp.com',\n          databaseURL: 'https://project-id.firebaseio.com',\n          storageBucket: 'yourapp.appspot.com',\n          projectId: 'project-id',\n          messagingSenderId: 'sender-id',\n          appId: 'app-id',\n          measurementId: 'measurement-id',\n        },\n        types: [\n          {\n            type: 'Book',\n            collection: 'books',\n            map: doc =\u003e ({\n              title: doc.title,\n              isbn: doc.isbn,\n              author___NODE: doc.author.id,\n            }),\n            conditions: [['status', '==', 'public']], // optional\n          },\n          {\n            type: 'Author',\n            collection: 'authors',\n            map: doc =\u003e ({\n              name: doc.name,\n              country: doc.country,\n              books___NODE: doc.books.map(book =\u003e book.id),\n            }),\n          },\n        ],\n      },\n    },\n  ],\n};\n```\n\n## Method 2: Firebase Admin SDK\n\n1. Get a private key for your Firebase project.\n2. Put that private key somewhere in your Gatsby project.\n3. `$ yarn add @deanc/gatsby-source-firestorer`\n4. Configure `gatsby-config.js`\n\n```javascript\nmodule.exports = {\n  plugins: [\n    {\n      resolve: '@deanc/gatsby-source-firestorer',\n      options: {\n        credential: require('./firebase.credentials.json'),\n        types: [\n          {\n            type: 'Book',\n            collection: 'books',\n            map: doc =\u003e ({\n              title: doc.title,\n              isbn: doc.isbn,\n              author___NODE: doc.author.id,\n            }),\n            conditions: [['status', '==', 'public']], // optional\n          },\n          {\n            type: 'Author',\n            collection: 'authors',\n            map: doc =\u003e ({\n              name: doc.name,\n              country: doc.country,\n              books___NODE: doc.books.map(book =\u003e book.id),\n            }),\n          },\n        ],\n      },\n    },\n  ],\n};\n```\n\n# Querying\n\nTo query\n\n```graphql\n{\n  allBooks {\n    edges {\n      node {\n        title\n        isbn\n        author {\n          name\n        }\n      }\n    }\n  }\n}\n```\n\n# Configurations\n\n| Key        | Description                                                                                                                                            |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| credential | Require your private key here                                                                                                                          |\n| config     | Put a valid firebaseConfig object here                                                                                                                 |\n| types      | Array of types, which require some of the following 3 keys                                                                                             |\n| type       | (required) The type of the collection, which will be used in GraphQL queries. Eg, when `type = Book`, the GraphQL types are named `book` and `allBook` |\n| collection | (required) The name of the collections in Firestore. Nested collections are **not** tested.                                                            |\n| map        | (required) A function to map your data in Firestore to Gatsby nodes, utilize the undocumented `___NODE` to link between nodes                          |\n| conditions | (optional) An array of where conditions. Corresponds directly to: https://firebase.google.com/docs/firestore/query-data/queries#simple_queries         |\n\n# Disclaimer\n\nNo maintenance/warranty are provided. Feel free to send in pull requests.\n\n# Acknowledgement\n\n- [gatsby-source-firebase (Original)](https://github.com/ReactTraining/gatsby-source-firebase)\n- [gatsby-source-firebase (Most recent fork)](https://github.com/tomphill/gatsby-source-firestore)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanc%2Fgatsby-source-firestorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeanc%2Fgatsby-source-firestorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeanc%2Fgatsby-source-firestorer/lists"}