Firestore Setup
All the firestore configuration you all need!
Requirements
- Ensure your Firebase project is already created.
- You should be logged into the Google account used for Firebase.
Steps to Setup Firestore Database
Step 1: Create Firestore Database
- Visit the Firebase Console.
- From the sidebar, go to Build → Firestore Database.
- Click Create database.
- Select Standard mode.
- Choose your desired location for the database
- Select Production mode.
- Click Enable to complete the setup
Step 2: Setup Firestore Rules
- In the Firebase Console, open the Rules tab.
- Copy and paste the following rules:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
- Click Publish.
Step 3: Setup Firestore Indexes
- Go to the Indexes tab in the Firebase Console → Click Create index.
🔹 Index 1
| Field Name | Order |
|---|---|
| entry_fee | Ascending |
| game_id | Ascending |
| player_2_uid | Ascending |
| prize | Ascending |
| status | Ascending |
| type | Ascending |
| player_1_uid | Ascending |
| name | Ascending |
- Collection ID: battles
- Query Scope: Collection
🔹 Index 2
| Field Name | Order |
|---|---|
| entry_fee | Ascending |
| game_id | Ascending |
| locked_by | Ascending |
| player_2_uid | Ascending |
| prize | Ascending |
| status | Ascending |
| type | Ascending |
| player_1_uid | Ascending |
| name | Ascending |
- Collection ID: battles
- Query Scope: Collection
⚠ Important Note
Ensure there are no spelling mistakes or extra spaces in any field name.
Even small mistakes will cause the system to break.
Conclusion
By following these steps, your Firestore setup will be correctly configured and fully ready to work with the Jhoom app
- Follow the video to setup Firestore properly.