{"id":18090804,"url":"https://github.com/easonchai/strapi-provider-upload-firebase-storage","last_synced_at":"2025-04-13T05:44:03.170Z","repository":{"id":37186000,"uuid":"399672198","full_name":"easonchai/strapi-provider-upload-firebase-storage","owner":"easonchai","description":"The best Strapi Media Library provider for Firebase Storage 🔥","archived":false,"fork":false,"pushed_at":"2023-01-25T00:11:39.000Z","size":462,"stargazers_count":7,"open_issues_count":10,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T05:43:56.424Z","etag":null,"topics":["firebase","hacktoberfest","strapi"],"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/easonchai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-08-25T03:01:23.000Z","updated_at":"2022-01-20T15:23:20.000Z","dependencies_parsed_at":"2023-02-14T03:03:36.997Z","dependency_job_id":null,"html_url":"https://github.com/easonchai/strapi-provider-upload-firebase-storage","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/easonchai%2Fstrapi-provider-upload-firebase-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easonchai%2Fstrapi-provider-upload-firebase-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easonchai%2Fstrapi-provider-upload-firebase-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easonchai%2Fstrapi-provider-upload-firebase-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easonchai","download_url":"https://codeload.github.com/easonchai/strapi-provider-upload-firebase-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670520,"owners_count":21142901,"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":["firebase","hacktoberfest","strapi"],"created_at":"2024-10-31T18:07:30.276Z","updated_at":"2025-04-13T05:44:03.145Z","avatar_url":"https://github.com/easonchai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"display: flex; align-items:center; justify-content: center; width: 100%\"\u003e\n  \u003cimg src=\"https://i.ibb.co/Nm9r7ss/bg.png\" alt=\"strapi-provider-upload-firebase-storage\"\u003e\n\u003c/div\u003e\n\n# Firebase Storage Media Library Provider for Strapi\n\nThe best Strapi Media Library provider for Firebase Storage 🔥\n\u003cbr\u003e\nSupports custom Firebase Storage buckets for Spark plan users.\n\n\u003cbr\u003e\n\n## 📝 Table of Contents\n\n- [Getting Started](#getting-started)\n- [Configurations](#configurations)\n- [Status](#status)\n- [FAQ Section](#faq-section)\n- [Contributions](#contributions)\n\n\u003cbr\u003e\n\n## Getting Started\n\nTo install the package, you can either use npm or yarn\n\n```bash\nnpm i strapi-provider-upload-firebase-storage\n\n# or\n\nyarn add strapi-provider-upload-firebase-storage\n```\n\nThen, you need to add a plugin config in order to use `strapi-provider-upload-firebase-storage`.\n\n**Example**\n\n`./config/plugins.js`\n\n```js\nmodule.exports = ({ env }) =\u003e ({\n  // ...\n  upload: {\n    provider: \"firebase-storage\",\n    providerOptions: {\n      serviceAccount: require(\"./SERVICE_ACCOUNT_KEY_PATH.json\"),\n      bucketUrl: env(\"STORAGE_BUCKET_URL\"),\n      uploadOptions: {},\n      deleteOptions: {},\n    },\n  },\n  // ...\n});\n```\n\nThere are two environment variables you need to create in your `.env`.\n\n**Example**\n\n`.env`\n\n```env\nSTORAGE_BUCKET_URL=\u003cPROJECT_NAME\u003e.appspot.com\n```\n\n| Environment Variables | Description                                                                                                                           |\n| :-------------------- | :------------------------------------------------------------------------------------------------------------------------------------ |\n| `STORAGE_BUCKET_URL`  | The name of your Firebase storage bucket. E.g. `gs://\u003cPROJECT_NAME\u003e.appspot.com` but omit the `gs://` when entering it in your `.env` |\n\n**⚠ Important Note!**\nYou should add your service account key (.json file) in your .gitignore to prevent it from being pushed to your repository!\n\n\u003cbr\u003e\n\nThat is all it takes to upload your images to Firebase storage via Strapi! 🎊\n\nIf you need help finding your service account key or bucket name, refer to the [FAQ section](#faq-section) below.\n\n\u003cbr\u003e\n\n## Configurations\n\nThe initialization configuration is passed down to the provider via the `options` parameter. (e.g: `admin.initializeApp()`). You can see the complete list of options [here](https://firebase.google.com/docs/database/admin/start).\n\nThere are a few additional configurations that you can pass into the provider. You can view all the optional [upload options here](https://googleapis.dev/nodejs/storage/latest/global.html#CreateWriteStreamOptions) and [delete options here](https://googleapis.dev/nodejs/storage/latest/File.html#delete).\n\n**Example**\n\n`./config/plugins.js`\n\n```js\nmodule.exports = ({ env }) =\u003e ({\n  // ...\n  upload: {\n    provider: \"firebase-storage\",\n    providerOptions: {\n      serviceAccount: require(\"./SERVICE_ACCOUNT_KEY_PATH.json\"),\n      bucketUrl: env(\"STORAGE_BUCKET_URL\"),\n      options: {},\n      customBucket: \"my-custom-bucket\",\n      debug: true,\n      uploadOptions: {\n        resumable: false,\n        private: true,\n      },\n      deleteOptions: {},\n    },\n  },\n  // ...\n});\n```\n\nBy default, all uploads are set to `public`. You can however change those by passing in the options into the `uploadOptions` object. Below is an example of additional options you can pass in.\n\n| Optional Parameters | Type      | Default Value | Possible Values                                                                                                      |\n| :------------------ | :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------- |\n| `debug`             | _boolean_ | `false`       | `true / false`                                                                                                       |\n| `options`           | _object_  | `{}`          | Refer to [official documentation](https://firebase.google.com/docs/admin/setup)                                      |\n| `customBucket`      | _string_  | `undefined`   | `\u003cBUCKET_NAME\u003e` Only applicable if you use the Spark plan \u0026 created a custom bucket                                  |\n| `uploadOptions`     | _object_  | `{}`          | Refer to [official documentation](https://googleapis.dev/nodejs/storage/latest/global.html#CreateWriteStreamOptions) |\n| `deleteOptions`     | _object_  | `{}`          | Refer to [official documentation](https://googleapis.dev/nodejs/storage/latest/File.html#delete)                     |\n\n\u003cbr\u003e\n\n## Status\n\n[![npm version](https://badge.fury.io/js/strapi-provider-upload-firebase-storage.svg)](https://badge.fury.io/js/strapi-provider-upload-firebase-storage)\n![CI](https://github.com/easonchai/strapi-provider-upload-firebase/actions/workflows/ci.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/easonchai/strapi-provider-upload-firebase-storage/badge.svg?branch=main)](https://coveralls.io/github/easonchai/strapi-provider-upload-firebase-storage?branch=main)\n[![Dependencies](https://status.david-dm.org/gh/easonchai/strapi-provider-upload-firebase-storage.svg)](https://status.david-dm.org/gh/easonchai/strapi-provider-upload-firebase-storage.svg)\n\n\u003cbr\u003e\n\n## FAQ Section\n\n\u003cbr\u003e\n1. Where can I get the service account key?\n\n- The service account key can be created by going to your Firebase console → Project settings → Service account → Click \"Generate new private key\". Then save that file anywhere safe. If saving in your repo, remember to add it into .gitignore!\n\n\u003cbr\u003e\n2. Where can I get the storage bucket url?\n\n- Go to your Firebase console → Project settings → Storage → Click \"Get Started\" (if its your first time setting up Firebase Storage for the project) → Copy the URL that looks like `gs://\u003cPROJECT_NAME\u003e.appspot.com` omitting the prefixed `gs://`.\n\n\u003cbr\u003e\n3. I keep getting an error `Cannot find module './SERVICE_ACCOUNT_KEY_NAME.json'`.\n\n- The file path is relative to your `./config/plugins.js`. So if your .env is in the root of your repo (it usually is), your path will be `../\u003cSERVICE_ACCOUNT_KEY_NAME\u003e.json`\n\n\u003cbr\u003e\n\n## Contributions\n\nContributions \u0026 suggestions are welcome! Please do test it out and let me know what additional features are missing or needed. Also do let me know about any bugs you find! 😉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasonchai%2Fstrapi-provider-upload-firebase-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasonchai%2Fstrapi-provider-upload-firebase-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasonchai%2Fstrapi-provider-upload-firebase-storage/lists"}