Skip to main content

How to Enable the Firebase Database

This app uses the Realtime Database to sync live game data (moves, turns, room state) between players with minimal latency.

  1. Open your Firebase project → Build → Realtime Database → Create Database.

  2. Choose a database location, then choose a starting mode for your security rules (test mode for development, locked mode for production — you can edit the rules any time afterwards). A database is created automatically and this is where your game data will be stored.

    Create Realtime Database Realtime Database created Security rules step in the setup dialog

Note: Firebase now recommends Cloud Firestore as the default database for new projects in general. This app specifically relies on Realtime Database for its low-latency multiplayer sync, so keep using Realtime Database unless you're intentionally migrating the game-sync logic to Firestore.

  1. Go to the Rules tab and set the rules below:

    {
    "rules": {
    ".read": "auth != null || auth.provider == 'anonymous'",
    ".write": "auth != null || auth.provider == 'anonymous'"
    }
    }

Note: These rules allow reads and writes only for authenticated users, including anonymous sign-ins, which the app uses for guest players. Never publish the database with ".read": true / ".write": true — that leaves all game data open to anyone.