File size: 1,347 Bytes
6ce679b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// src/firebase.js

import { initializeApp } from "firebase/app";
import { getAuth, GoogleAuthProvider } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
import { getAnalytics, isSupported } from "firebase/analytics";

// 🔹 Your Firebase configuration
const firebaseConfig = {
  apiKey: "AIzaSyDonQCMhJ5jQ3kiheFvAeWxJ8MtH1cRcXk",
  authDomain: "humanizer-x-16baa.firebaseapp.com",
  projectId: "humanizer-x-16baa",
  storageBucket: "humanizer-x-16baa.appspot.com",
  messagingSenderId: "513434319424",
  appId: "1:513434319424:web:74912c65b196c62dc87da5",
  measurementId: "G-H94EMGYRNF",
};

// ✅ Initialize Firebase app
const app = initializeApp(firebaseConfig);

// ✅ Firebase services exports
export const auth = getAuth(app);
export const provider = new GoogleAuthProvider();
export const db = getFirestore(app);       // Firestore database
export const storage = getStorage(app);    // Storage for profile images

// ✅ Analytics (optional)
export let analytics;
if (typeof window !== "undefined") {
  isSupported().then((supported) => {
    if (supported) {
      analytics = getAnalytics(app);
    }
  });
}

// ✅ Optional init function (if needed elsewhere)
export async function initFirebase() {
  return { app, auth, db, storage, provider, analytics };
}