Firebase Standards
Firestore Collection Naming
Collections that are synced with Airtable start with an underscore (_). This tells our cloud functions to attempt to sync that data back to Airtable.
Firestore env Collection
We have an env collection in Firestore that contains environment variables for the Firebase project. This is useful for storing sensitive information such as API keys, or configuration settings that the app needs to run.
Environment variables should be stored in a document named after the application or service that they are associated with. Examples:
the API keys for the email API service are stored at
env/emailApithe settings for the metrics app are stored at
env/metrics
Function Naming
Since we store and update functions from multiple repositories, each repository should have its own prefix for the functions it contains. This helps to avoid naming conflicts and makes it easier to identify which repository a function belongs to.
For example, all Airtable related functions are prefixed with at.
Firestore Configuration for Functions
It is recommended to always set the codebase field in firebase.json to a name that is unique to the repository. This helps to avoid errors in CI/CD pipelines when deploying functions, and avoid overwriting functions from other repositories.