Search code examples
firebasegoogle-cloud-firestorefirebase-security

How to export security and index rules from Firestore?


I've set up multiple different indexes on my Firestore development database. Now, I would like to export them into the firestore.indexes.json so that the process of setting up prod environment would be easier. Is there a way to export those indexes using Firebase CLI? The same applies to security rules, although I know that I can copy paste them.


Solution

  • In your Firebase project folder execute this in the terminal:

    firebase firestore:indexes > firestore.indexes.json
    

    And it will save a file called firestore.indexes.json with your indexes.

    You can then upload that file onto other Firebase projects.