Step 1: Firebase Setup (The Database)
- Go to the Firebase Console and create a new project.
Create the database
- Navigate to Firestore Database in the sidebar.
- Click Create Database.
- Select a location (e.g.
nam5oreur3). - Start in Production Mode.
Set security rules
Go to the Rules tab in Firestore and replace the rules with the following. This allows anyone to read, but only your backend (via the Admin SDK) can write:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
// 1. Allow Read: Essential for your HTML page to fetch chats.
allow read: if true;
// 2. Allow Update: Enables the "Rename Chat" feature from the frontend.
// This allows updating existing documents (like changing the name)
// but prevents creating NEW documents or Deleting them.
allow update: if true;
// 3. Block Create/Delete: Only the Backend (Render) can create new messages
// or delete them. This prevents random people from injecting fake chats.
allow create, delete: if false;
}
}
}
Get backend credentials (service account)
- Go to Project Settings (gear icon) → Service accounts.
- Click Generate new private key.
- This downloads a
.jsonfile.
Keep this safe
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.
Get frontend configuration
- Go to Project Settings → General.
- Scroll to "Your apps" and click the Web (
</>) icon. - Register the app (nickname: "Logger Frontend").
- Copy the
firebaseConfigobject (API key, project ID, etc.) — you'll need it forindex.htmllater.
Continue to Deploy the Backend.