> For the complete documentation index, see [llms.txt](https://edentech.gitbook.io/glover/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edentech.gitbook.io/glover/firebase/firebase-storage.md).

# Firebase Storage

In-app chat system supports image sharing, the images are shared and uploaded through firebase storage. By default the Firebase storage is not enabled on your firebase, you need to create the firebase storage on your firebase.

To create a Firebase Storage in your Firebase project, follow these steps:

1. Create a Firebase Project:
   * Go to the Firebase console at <https://console.firebase.google.com/>.
   * Click on "Add project" or select an existing project where you want to add Firebase Storage.
   * Follow the instructions to set up your project.
2. Enable Firebase Storage:
   * Once your project is created or selected, click on "Build" from the left menu.
   * Select "Storage" from the options.
3. Set Up Firebase Storage:
   * Click on the "Get Started" button.
   * Review the storage rules and modify them to use the rule stated at the bottom section of this page. These rules determine who can access your storage and what operations they can perform.
   * Click on "Next" to proceed.
4. Choose a Storage Location:
   * Select the geographic location where you want your storage to be stored.
   * Firebase provides multiple options for storage locations.
   * Click on "Done" to complete the setup.

## Firebase Storage Security

Same has setting security for the firebase firestore to protect your data, you also need to set security rules to protect images upload via chat to the firebase storage.

Below is the security rule that should be set for the firebase storage:<br>

{% code overflow="wrap" lineNumbers="true" %}

```bash
rules_version = '2';

// Craft rules based on data in your Firestore database
// allow write: if firestore.get(
//    /databases/(default)/documents/users/$(request.auth.uid)).data.isAdmin;
service firebase.storage {
  match /b/{bucket}/o {

    // This rule allows anyone with your Storage bucket reference to view, edit,
    // and delete all data in your Storage bucket. It is useful for getting
    // started, but it is configured to expire after 30 days because it
    // leaves your app open to attackers. At that time, all client
    // requests to your Storage bucket will be denied.
    //
    // Make sure to write security rules for your app before that time, or else
    // all client requests to your Storage bucket will be denied until you Update
    // your rules
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edentech.gitbook.io/glover/firebase/firebase-storage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
