This app expects Firebase configuration to be provided in firebase-config.js and loaded before script.js.
- Copy
firebase-config.jsand replace the placeholder values with the config from your Firebase project:window.FIREBASE_CONFIG = { apiKey: "YOUR_API_KEY", authDomain: "YOUR_PROJECT_ID.firebaseapp.com", projectId: "YOUR_PROJECT_ID", appId: "YOUR_APP_ID" };
- For environment-specific values, keep different
firebase-config.jsfiles per environment (local, staging, prod) and swap them during deployment, or have your hosting pipeline inject the correct values.
-
Create a Firebase project in the Firebase console.
-
Enable Authentication: go to Build → Authentication → Sign-in method and enable Email/Password.
-
Create Firestore: go to Build → Firestore Database and create a database in your preferred region.
-
(Optional) Create Realtime Database: go to Build → Realtime Database if you plan to use it.
-
Deploy security rules:
- Firestore rules are in
firestore.rules. - Realtime Database rules are in
database.rules.json.
Using the Firebase CLI:
firebase deploy --only firestore:rules firebase deploy --only database
- Firestore rules are in
All user data is written beneath a users/{uid} path, matching the security rules. The app currently writes:
users/{uid}(user metadata such as encryption salt)users/{uid}/fastingState/state(encrypted app state)
Ensure your rules continue to allow only the authenticated user (request.auth.uid) to read/write their own data.