{"id":15697997,"url":"https://github.com/healeycodes/gatsby-serverless-comments","last_synced_at":"2025-05-09T01:04:40.915Z","repository":{"id":44824003,"uuid":"260924719","full_name":"healeycodes/gatsby-serverless-comments","owner":"healeycodes","description":"🔧  Use Netlify serverless functions to add commenting to a static website","archived":false,"fork":false,"pushed_at":"2022-01-22T11:59:13.000Z","size":438,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-09T01:04:18.711Z","etag":null,"topics":["blog","comments","gatsby","netlify","netlify-serverless-functions","serverless"],"latest_commit_sha":null,"homepage":"https://healeycodes.com/adding-comments-to-gatsby-with-netlify-and-github/","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/healeycodes.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}},"created_at":"2020-05-03T13:22:39.000Z","updated_at":"2021-01-04T10:23:20.000Z","dependencies_parsed_at":"2022-09-03T04:11:57.880Z","dependency_job_id":null,"html_url":"https://github.com/healeycodes/gatsby-serverless-comments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/healeycodes%2Fgatsby-serverless-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/healeycodes%2Fgatsby-serverless-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/healeycodes%2Fgatsby-serverless-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/healeycodes%2Fgatsby-serverless-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/healeycodes","download_url":"https://codeload.github.com/healeycodes/gatsby-serverless-comments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171253,"owners_count":21865292,"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":["blog","comments","gatsby","netlify","netlify-serverless-functions","serverless"],"created_at":"2024-10-03T19:22:31.137Z","updated_at":"2025-05-09T01:04:40.859Z","avatar_url":"https://github.com/healeycodes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-serverless-comments\n\n\u003e My blog post: [Adding Comments to Gatsby with Netlify Serverless Functions + GitHub](https://healeycodes.com/adding-comments-to-gatsby-with-netlify-and-github/)\n\n\u003cbr\u003e\n\nUse Netlify serverless functions to let users add comments to a static website.\n\n1. 👩 User enters a comment and clicks submit.\n2. ⚙️ A serverless function receives the data and hits GitHub's API.\n3. 🔧 It reads the existing `comments.json` , appends the new comment, and saves.\n4. 🚧 A new commit triggers a Netlify build.\n5. ✅ The new version of the website is deployed!\n\nThe new comment is visible ~30 seconds ⏰ after the first click.\n\n\u003cbr\u003e\n\nSee `/src/pages/index.js` for the user visible page.\n\nSee `/functions/comment.js` for the serverless function.\n\n## Why?\n\n- Accept user comments and store them on GitHub. No database required.\n\n- Avoid using third-party plugin solutions that leak your user's data.\n\n\u003cbr\u003e\n\n## Setup\n\nSet the following environmental variables on Netlify:\n\n- `GITHUB_PAT_TOKEN` to your GitHub personal access token.\n- `GITHUB_REPO` to the repository where this code is located.\n- `GITHUB_USER` your GitHub username.\n\n\u003cbr\u003e\n\nSet up the site on Netlify to continuously deploy on commits (this the default).\n\nVisit the deploy preview, or production version, and submit a comment from the root path (`/`). There is a example form that submits a `PUT` request.\n\nYou should see a `204` response in the browser console. Else, check the Netlify functions logs for errors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhealeycodes%2Fgatsby-serverless-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhealeycodes%2Fgatsby-serverless-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhealeycodes%2Fgatsby-serverless-comments/lists"}