Skip to main content

FIRESTORE REFERENCE

This README contains vital information on setting up Firestore for a copy of your Ring project.

Indexes

Create a firestore.indexes.json file with the following content:

{
"indexes": [
{
"collectionGroup": "opportunities",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "visibility", "order": "ASCENDING" },
{ "fieldPath": "deadline", "order": "ASCENDING" }
]
},
{
"collectionGroup": "opportunities",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "visibility", "order": "ASCENDING" },
{ "fieldPath": "type", "order": "ASCENDING" },
{ "fieldPath": "dateAdded", "order": "DESCENDING" }
]
},
{
"collectionGroup": "entities",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "visibility", "order": "ASCENDING" },
{ "fieldPath": "type", "order": "ASCENDING" },
{ "fieldPath": "name", "order": "ASCENDING" }
]
},
{
"collectionGroup": "userProfiles",
"queryScope": "COLLECTION",
"fields": [
{ "fieldPath": "name", "order": "ASCENDING" },
{ "fieldPath": "email", "order": "ASCENDING" }
]
}
],
"fieldOverrides": []
}

Data Structure

Ensure your Firestore collections follow these structures:

  1. opportunities: Contains documents representing opportunities.
  2. entities: Contains documents representing entities (companies, organizations).
  3. userProfiles: Contains documents representing user profiles.
  4. userSettings: Contains documents representing user settings.
  5. contactForms: Contains documents representing submitted contact forms.

Refer to the TypeScript interfaces in your project for detailed field information.

Local Development

  1. Install the Firebase CLI:
npm install -g firebase-tools
  1. Log in to Firebase:
firebase login
  1. Initialize your project:
firebase init firestore
  1. Use the Firebase Local Emulator Suite for testing:
firebase emulators:start

Deployment

To deploy Firestore rules:

firebase deploy --only firestore:rules

To deploy Firestore indexes:

firebase deploy --only firestore:indexes

To deploy both rules and indexes:

firebase deploy --only firestore

Remember to update your Firebase configuration in your app's environment variables when switching between development and production environments.