Create the Project
QuizMS uses several Firebase services:
- Firestore for the database;
- Storage for saving texts;
- Hosting for the website;
- Authentication for user authentication.
The simplest way to configure them is by using the Firebase web interface.
Prerequisites
Install Firebase CLI and Google Cloud SDK:
- Arch Linux:
- macOS:sh
$ brew install firebase-cli google-cloud-sdk
- Manual installation:
Create a New Project on Firebase
- Go to the Firebase console and click on "Add project".
- Once the project is created, on the home page, click the button with the code symbol to add a web app.
- Use the nickname "web" and click "Register app".
- Copy the Firebase configuration object and paste it into the
firebase-config.js
file of the project.
Configure Firestore
- Access the Firebase console;
- Go to all products;
- Go to Cloud Firestore;
- Click on "Create database";
- Choose the location
europe-west6
(Zurich) and click "Next"; - Select "production mode" and click "Create";
Configure Storage
- Access the Firebase console;
- Go to all products;
- Go to Storage;
- Click on "Get started";
- Select
europe-west6
and click "Continue"; - Select "production mode" and click "Create";
Configure Authentication
- Access the Firebase console;
- Go to all products;
- Go to Authentication;
- Click on "Get started";
- Select "Email/password" from the native providers;
- Enable "Email/password" and click "Save";
- Click "Add new provider";
- Select "Anonymous" from the native providers;
- Enable "Anonymous" and click "Save";
- Go to the "Settings" tab and in the "User actions" section, disable "Email enumeration protection";
Configure Hosting
- Access the Firebase console;
- Go to all products;
- Go to Hosting;
- Click on "Get started";
- Ignore all steps and click "Next" until you reach the end;
- To configure the domain, go to "Add custom domain" and follow the instructions. The domain must be configured at least 24 hours before the start of the contest.
Select the Paid Plan
- Access the Firebase console;
- At the bottom left, next to the word "Spark", click "Upgrade";
- Choose the Blaze pay-as-you-go plan and set up payment.
Complete the Configuration
- Authenticate with Google Cloud:sh
$ gcloud auth application-default login
- Initialize the local project:sh
$ npx quizms firebase init
- Upload security rules and indexes:sh
$ firebase deploy --only firestore,storage