docs

Log | Files | Refs | Activity

root / src / whatsapp-logger / firebase-setup.md

firebase-setup.md (2284B)


      1 ---
      2 label: 1. Firebase Setup
      3 order: 880
      4 ---
      5 
      6 # Step 1: Firebase Setup (The Database)
      7 
      8 1. Go to the [Firebase Console](https://console.firebase.google.com/) and create a new project.
      9 
     10 ## Create the database
     11 
     12 1. Navigate to **Firestore Database** in the sidebar.
     13 2. Click **Create Database**.
     14 3. Select a location (e.g. `nam5` or `eur3`).
     15 4. Start in **Production Mode**.
     16 
     17 ## Set security rules
     18 
     19 Go to the **Rules** tab in Firestore and replace the rules with the following. As of v4.2.1, the frontend never talks to Firestore directly — it only talks to your Render backend, which uses the Admin SDK (which always bypasses these rules regardless of what they say). So there's no reason for any client-side reads or writes to be allowed:
     20 
     21 ```javascript
     22 rules_version = '2';
     23 service cloud.firestore {
     24   match /databases/{database}/documents {
     25     match /{document=**} {
     26       // Deny all direct client access. The Admin SDK (your Render backend)
     27       // bypasses these rules entirely, so this only blocks browsers/apps
     28       // that try to read or write Firestore directly with a client SDK.
     29       allow read, write: if false;
     30     }
     31   }
     32 }
     33 ```
     34 
     35 !!!danger If you're upgrading from an older version
     36 Earlier versions of this project shipped a public `firebaseConfig` in the frontend with permissive `allow read: if true` rules — this let anyone who inspected the page source read your entire chat database directly, bypassing the login screen. If you're on v4.2.1 or later, switch to the rules above and make sure your `index.html` has no `firebaseConfig` or Firebase SDK `<script>` tags left in it (see [Setup the Frontend](setup-frontend.md)).
     37 !!!
     38 
     39 ## Get backend credentials (service account)
     40 
     41 1. Go to **Project Settings** (gear icon) → **Service accounts**.
     42 2. Click **Generate new private key**.
     43 3. This downloads a `.json` file.
     44 
     45 !!!danger Keep this safe
     46 This file grants admin access to your database. You'll paste its contents into a Render environment variable in the next step — never commit it to a public repo.
     47 !!!
     48 
     49 That's everything you need from Firebase — the frontend doesn't need any Firebase configuration at all. It only ever talks to your Render backend, which uses the service account credentials above.
     50 
     51 Continue to [Deploy the Backend](deploy-backend.md).
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror