{"id":18049646,"url":"https://github.com/alextim/contact-form-firebase-functions","last_synced_at":"2026-06-11T16:31:32.079Z","repository":{"id":92113376,"uuid":"267822804","full_name":"alextim/contact-form-firebase-functions","owner":"alextim","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T02:52:29.000Z","size":6,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T06:15:18.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/alextim.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-29T09:48:58.000Z","updated_at":"2020-05-31T06:53:23.000Z","dependencies_parsed_at":"2023-12-15T03:44:39.232Z","dependency_job_id":"ea657a2e-3fef-411b-a828-621680798ca1","html_url":"https://github.com/alextim/contact-form-firebase-functions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alextim/contact-form-firebase-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alextim%2Fcontact-form-firebase-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alextim%2Fcontact-form-firebase-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alextim%2Fcontact-form-firebase-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alextim%2Fcontact-form-firebase-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alextim","download_url":"https://codeload.github.com/alextim/contact-form-firebase-functions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alextim%2Fcontact-form-firebase-functions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34208762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":[],"created_at":"2024-10-30T21:08:21.291Z","updated_at":"2026-06-11T16:31:32.055Z","avatar_url":"https://github.com/alextim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Settings\n\n## Firebase\n- [Firebase Console](https://console.firebase.google.com)\n- [Cloud Console - Functions](https://console.cloud.google.com/functions)\n\n**Important:** Firebase Hosting supports Cloud Functions in us-central1 only (2020).\n\n### Database\n#### Add \n#### Rules\n```\nrules_version = '2';\nservice cloud.firestore {\n  match /databases/{database}/documents {\n  \tfunction isSignedIn() {\n      return true || request.auth.uid != null;\n    }\n    function existingData() {\n      return resource.data;\n    }\n    function incomingData() {\n      return request.resource.data;\n    }\n    function validateEmail() {\n      return incomingData().email is string \u0026\u0026 incomingData().email.size() \u003e 2 \u0026\u0026 incomingData().email.size() \u003c= 254;\n    }\n    function validateName() {\n      return incomingData().name is string \u0026\u0026 incomingData().name.size() \u003e 1 \u0026\u0026 incomingData().name.size() \u003c= 40;\n    }\n    function validateMessage() {\n      return incomingData().message is string \u0026\u0026 incomingData().message.size() \u003e 1 \u0026\u0026 incomingData().message.size() \u003c= 256;\n    }\n    function validateData() {\n      return validateName() \u0026\u0026 validateEmail() \u0026\u0026 validateMessage();\n    }\n    match /emails/{document=**} {\n      allow read, delete, update: if isSignedIn();\n      allow create: if validateData();\n    }\n  }\n}\n```\n\n## GMail\n\n### Common\n[Check Gmail through other email platforms](https://support.google.com/mail/answer/7126229)\n\n### Troubleshooting\n* [Enable less secure app access](https://myaccount.google.com/lesssecureapps)\n* [Unlock Captcha](https://accounts.google.com/b/0/displayunlockcaptcha)\n\n\n# Production\n## index.js\n1. EMAIL_FIELD    'tvtqk' -\u003e 'your-field'  \n1. ALLOWED_ORIGIN '*'     -\u003e 'your-domain'\n## Deploy\n```\n\u003e cd functions\n\u003e firebase login\n\u003e firebase deploy\n```\nafter modifications\n```\n\u003e firebase deploy --only functions\n``` \n\n# To-Do\n1. [ ] function isSpam        -\u003e request.body.contans(\u003ca /\u003e || \u003cscript /\u003e)\n1. [ ] js                     -\u003e ts\n1. [ ] then                   -\u003e async/await  + try/catch\n\n---\n# Inspired by\n- https://stackoverflow.com/questions/24098461/nodemailer-gmail-what-exactly-is-a-refresh-token-and-how-do-i-get-one/24123550\n- https://masashi-k.blogspot.com/2013/06/sending-mail-with-gmail-using-xoauth2.html\n- https://blog.mailtrap.io/nodemailer-gmail/\n\nDatabase Rules\n\n- https://fireship.io/snippets/firestore-rules-recipes/\n- https://stackoverflow.com/questions/51916848/achieving-granular-data-validation-in-firestore-document?rq=1\n- https://softauthor.com/firestore-security-rules","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextim%2Fcontact-form-firebase-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falextim%2Fcontact-form-firebase-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextim%2Fcontact-form-firebase-functions/lists"}