The Code (Cont.): Setup

const firebaseConfig = {
Copy the configuration file after setting up your web application from the Firebase Console by following the options:
  Firebase (home) ⇒ Firebase </> ⇒ Web App ✿ ⇒ Configuration
  • apiKey: An API key is a unique string that is used to route requests to your Firebase project when interacting with Firebase and Google services. Specifically, they are used to associate API requests with your project for quota and billing.

  • projectId: A user-assigned unique identifier for your Firebase project. This identifier may appear in URLs or names for some Firebase resources, but it should generally be treated as a convenience alias to reference your project.

  • appId: Use this number to identify your app when you contact Firebase support.


firebase.initializeApp( firebaseConfig );
Creates and initializes a FirebaseApp instance. A Firebase app is a container-like object that stores common configuration and shares authentication across Firebase services. After you initialize a Firebase app object in your code, you can add and start using Firebase services.

var usersRef = firebase.database( ).ref( 'users/' );
The function ref returns a reference representing the location in the database corresponding to the provided path. If no path is provided, the reference will point to the root of the database.
  <script type="module">
   // Your web app's Firebase configuration
   // For Firebase JS SDK v7.20.0 and later, measurementId is optional
   const firebaseConfig = {
    apiKey: "AIzaSyB🟦98e04OlRJe🟦4Gs0jXFgNgVPfijfDwjk",
    authDomain: "fir-20-68820.firebaseapp.com",
    databaseURL: "https://fir-20-68820-default-rtdb.firebaseio.com",
    projectId: "fir-20-68820",
    storageBucket: "fir-20-68820.appspot.com",
    messagingSenderId: "506458698814",
    appId: "1:506458698814:web:9f8b957ed06e413e9a0d6f",
    measurementId: "G-3LBG0YT669"
   };

   // Initialize Firebase
   firebase.initializeApp( firebaseConfig );
   var usersRef = firebase.database( ).ref( 'users/' );
  </script>