Common Firebase Configuration
This guide will help you set up Firebase for Elite Quiz, step by step. No prior experience with Firebase is required. Just follow along, and you’ll be ready in no time.
Why Do I Need Firebase?
Elite Quiz uses Firebase for two main things:
- Authentication: Let users sign in with Email, Google, Apple, or Phone.
- Firestore Database: Store battle quiz progress, battle messages.
Step 1: Create Your Firebase Project
- Go to the Firebase Console.
- Click Add project.
- Enter a project name (e.g.,
EliteQuiz
) and accept the terms. - Choose whether to enable Google Analytics (recommended for most users).
- Click Create project and wait for setup to finish.
You’ll see your new project dashboard when it’s ready.
Step 2: Enable Sign-In Methods
Elite Quiz supports several ways for users to sign in. Enable them all now — you can turn off any you don’t want later from the admin panel.
To use Phone/OTP Login, your Firebase project must be on the Blaze (pay-as-you-go) plan. This feature will not work on the Spark (free tier) plan.
How to enable sign-in methods:
- In your Firebase project, click Authentication in the left menu.
- Go to the Sign-in method tab.
- Enable these providers:
- Email/Password
- Phone
- Apple
Tip: To control which sign-in options are visible to your users, use the Elite Quiz admin panel:
- Go to
Settings > Authentication Settings
.- Turn off any methods you don’t want users to see.
Step 3: Set Up Firestore Database
Elite Quiz uses Firestore to store real-time data for battle quizzes, like quiz progress and chat messages.
Option 1: Watch the Setup Video
Option 2: Follow These Steps
-
In Firebase, click Build in the left menu, then select Firestore Database.
-
Click Create database.
-
Choose the location closest to your users and confirm.
-
Set Firestore Security Rules:
- Go to the Rules tab.
- Delete any existing rules and paste in the following:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid != null;
}
}
} -
Create an Index for Messaging
- This is needed for the in-game chat feature.
- In Firestore, go to the Indexes tab.
- Click Add Index and fill in:
- Collection ID:
messages
- First Field:
roomId
(Ascending) — note the capital "I" - Second Field:
timestamp
(Descending) - Query Scope: Collection
- Collection ID:
What’s Next?
- You’re done with the common Firebase setup! 🎉
- Now, follow the next guide for your platform (mobile or web) to finish integration.