Skip to content

Database

This starter template uses Firebase Cloud Firestore as a flexible, scalable NoSQL cloud database.

Deployment

Rules

The deployment of the database rules is done via the Firebase CLI or the Firebase Console. To deploy the database rules via the Firebase CLI, a rules file is required. This starter template provides a rules file at firebase/firestore.rules.

To deploy the rules file manually, run the following command:

npm run firebase:deploy:firestore:rules

See CI/CD.

If you choose to publish changes via the Firebase Console, you should either add new changes manually to the firebase/firestore.rules file so that they are not reverted during the next deployment, or you should disable the corresponding deployment step in the CI/CD pipeline (see CI/CD).

Indexes

The deployment of the database indexes is done via the Firebase CLI or the Firebase Console. To deploy the database indexes via the Firebase CLI, an indexes file is required. This starter template provides an indexes file at firebase/firestore.indexes.json.

To deploy the indexes file manually, run the following command:

npm run firebase:deploy:firestore:indexes

See CI/CD.

If you choose to publish changes via the Firebase Console, you should either add new changes manually to the firebase/firestore.indexes.json file so that they are not reverted during the next deployment, or you should disable the corresponding deployment step in the CI/CD pipeline (see CI/CD).

Run the following command to download the current indexes from the Firebase Console and save them to the firebase/firestore.indexes.json file:

npm run firebase:firestore:indexes