{"id":23857415,"url":"https://github.com/ekaputra07/firesub","last_synced_at":"2026-05-29T13:30:18.440Z","repository":{"id":38782041,"uuid":"248876043","full_name":"ekaputra07/firesub","owner":"ekaputra07","description":"Firebase Functions helpers to publish your Cloud Firestore or Cloud Storage events to PubSub. https://www.npmjs.com/package/firesub","archived":false,"fork":false,"pushed_at":"2023-01-09T22:34:57.000Z","size":573,"stargazers_count":0,"open_issues_count":20,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T04:05:17.035Z","etag":null,"topics":["cloud-functions","firestore","gcp","pubsub"],"latest_commit_sha":null,"homepage":"","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/ekaputra07.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-03-21T00:06:53.000Z","updated_at":"2020-10-27T02:17:56.000Z","dependencies_parsed_at":"2023-02-08T15:05:11.024Z","dependency_job_id":null,"html_url":"https://github.com/ekaputra07/firesub","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/ekaputra07%2Ffiresub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekaputra07%2Ffiresub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekaputra07%2Ffiresub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekaputra07%2Ffiresub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekaputra07","download_url":"https://codeload.github.com/ekaputra07/firesub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240158385,"owners_count":19757153,"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":["cloud-functions","firestore","gcp","pubsub"],"created_at":"2025-01-03T02:55:05.648Z","updated_at":"2026-05-29T13:30:18.369Z","avatar_url":"https://github.com/ekaputra07.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FireSub\nFiresub is a Firebase Functions helper to easily publish Firestore or Storage events to PubSub.\n\nThere will be a case where you want handle all of your Firestore or Storage events in a single (monolithic) app instead of handle them separately as collection of microservices (Firebase Functions). Also it will also useful if you want to handle those events outside of GCP environment.\n\n**Firesub will helps you to build the bridge** between the events and the worker that process the events. Allows you to be more flexible to design your system infrastructure and process the event with the language of your choice.\n\n**Note:** Firesub is not a standalone service, it provides you helper functions to make it easily for you to create the _\"bridge\"_. The bridge it self will be just a normal Firebase Functions but Firesub will helps creating them a breeze.\n\n## Install\n\n```\nnpm install --save firesub\n```\n\n## Quick Start\n\nWe'll create a couple of Firebase Functions that will publish an event when:\n\n- A new document created on your Firestore collection\n- A file has been uploaded into your Cloud Storage bucket\n\n```\nconst admin = require('firebase-admin')\nconst firesub = require('firesub')\n\nadmin.initializeApp()\n\nexports.postCreated = firesub.FirestoreOnCreate('/posts/{id}', 'topic_foo')\nexports.fileUploaded = firesub.StorageOnFinalize('my-gs-bucket', 'topic_bar')\n```\n\nDeploy them:\n\n```\nfirebase deploy --only functions\n```\n\nWhen all are good you will have two Firebase Functions (`postCreated`, `fileUploaded`) deployed and ready to push events to PubSub topics of your choosing.\n\n_Please note that **all of those PubSub topic must be created first** before you able to publish messages into it._\n\n## Available Events\n\nCurrently it's only available for Firestore and Cloud Storage events, but I might add more in the future.\n\n|GCP Products|Events|Description|\n|------|------|------|\n|Firestore|FirestoreOnWrite|when document `created` or `updated` or `deleted`|\n||FirestoreOnCreate|when document `created`|\n||FirestoreOnUpdate|when document `updated`|\n||FirestoreOnDelete|when document `deleted`|\n|Storage|StorageOnFinalize|when a new file is `created` (or an existing object is `overwritten`, and a new generation of that object is created) in the bucket|\n||StorageOnArchive|when a live version of an object is `archived` or deleted|\n||StorageOnDelete|when a file is permanently `deleted`|\n||StorageOnMetadataUpdate|when the `metadata` of an existing object `changes`|\n\nMore info about Firestore trigger events [here](https://firebase.google.com/docs/functions/firestore-events) and more about Cloud Storage trigger events [here](https://firebase.google.com/docs/functions/gcp-storage-events)\n\n## PubSub Message Format\n\nBelow are message formats that are published to topic for each event type.\n\n#### `FirestoreOnWrite`, `FirestoreOnUpdate`\n\n```\n{\n   \"id\": \"document ID\",\n   \"timestamp\": \"2020-03-21T04:24:15.789595Z\",\n   \"before\": {... document before ...},\n   \"after\": {... document after ...}\n}\n```\n\n#### `FirestoreOnCreate`, `FirestoreOnDelete`\n\n```\n{\n   \"id\": \"document ID\",\n   \"timestamp\": \"2020-03-21T04:24:15.789595Z\",\n   \"data\": {... document that created or deleted ...}\n}\n```\n\n#### `StorageOnFinalize`, `StorageOnArchive`, `StorageOnDelete`, `StorageOnMetadataUpdate`\n\n```\n{\n   \"file\": {... file information ...},\n   \"context\": {... event context ...}\n}\n```\n\n## Example usage\n\nYou could see example project [here](https://github.com/ekaputra07/firesub/tree/master/example/functions)\n\n## Contribution\n\nThis is young project, created because I need it for my own project thats why the events that are supported is very limited at this stage. If you would like it to support more events your contribution are welcome.\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2020 Eka Putra\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekaputra07%2Ffiresub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekaputra07%2Ffiresub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekaputra07%2Ffiresub/lists"}