https://github.com/stackcheats/sc-firebase-comments-source-plugin
A StackCheats (Gatsby) Source Plugin for Comments
https://github.com/stackcheats/sc-firebase-comments-source-plugin
comments firebase gatsby-plugin source stackcheats
Last synced: 3 months ago
JSON representation
A StackCheats (Gatsby) Source Plugin for Comments
- Host: GitHub
- URL: https://github.com/stackcheats/sc-firebase-comments-source-plugin
- Owner: stackcheats
- License: mit
- Created: 2021-05-08T17:09:21.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T06:44:18.000Z (about 4 years ago)
- Last Synced: 2024-04-26T03:03:56.188Z (about 1 year ago)
- Topics: comments, firebase, gatsby-plugin, source, stackcheats
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Comments
A Gatsby source plugin to retrieve comments from Firebase
for StackCheats. Please find the plugin configurations and docs below.[:construction: Plugin Under Development]
## Configure
Add the following plugin configuration in `gatsby-config.js` to activate the plugin
```js
{
resolve: `sc-firebase-comments`,
options: {
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.FIREBASE_AUTH_DOMAIN,
projectId: process.env.FIREBASE_PROJECT_ID,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
appId: process.env.FIREBASE_APP_ID,
measurementId: process.env.FIREBASE_MEASUREMENT_ID,
},
}
```To communicate with Firebase, the following configurations are required
```sh
apiKey API Key to communicate with the Firebase
authDomain Firebase authentication domain
projectId Firebase project ID
storageBucket Firebase storage bucket that has been configured
messagingSenderId Firebase messaging sender ID
appId Firebase application ID
measurementId Firebase measurement ID
```## Firebase Collection
The collection (should be) is created and named as `comments` with the following document structure
```json
{
"_parentId": null,
"author": string,
"slug": string,
"content": string,
"createdAt": timestamp
}
```## Usage
Following GraphQL can be used to retrieve the comments
```graphql
allStackCheatsComments(filter: { slug: { eq: $slug } }) {
edges {
node {
_id
_parentId
author
content
createdAt
}
}
}
```## License
[MIT](LICENSE)