Project setup and initialization

identify the Firebase project (client SDK)

The config object stores credentials to identify the Firebase project when interacting with Google servers:

const firebaseConfig = {
    apiKey: "....",
    authDomain: ".....firebaseapp.com",
    projectId: "....",
    storageBucket: ".....firebasestorage.app",
    messagingSenderId: "....",
    appId: "....",
}

register one or more configs

We register the config (client SDK) and keep a reference to the app helper , which we initialize other services with:

const app = initializeApp(firebaseConfig)

When working with several Firebase projects, we get a helper for each. The first helper has a "[DEFAULT]" internal string identifier. We provide string identifiers for the additional project we want to work with.

const app1 = initializeApp(firebaseConfig1)
const app2 = initializeApp(firebaseConfig2, "bar")

When initializing the admin SDK on Google servers that run Cloud Functions, the admin SDK finds the credentials on its own. We initialize it without a config:

const app = initializeApp()
earlymorning logo

Project setup and initialization

identify the Firebase project (client SDK)

The config object stores credentials to identify the Firebase project when interacting with Google servers:

const firebaseConfig = {
    apiKey: "....",
    authDomain: ".....firebaseapp.com",
    projectId: "....",
    storageBucket: ".....firebasestorage.app",
    messagingSenderId: "....",
    appId: "....",
}

register one or more configs

We register the config (client SDK) and keep a reference to the app helper , which we initialize other services with:

const app = initializeApp(firebaseConfig)

When working with several Firebase projects, we get a helper for each. The first helper has a "[DEFAULT]" internal string identifier. We provide string identifiers for the additional project we want to work with.

const app1 = initializeApp(firebaseConfig1)
const app2 = initializeApp(firebaseConfig2, "bar")

When initializing the admin SDK on Google servers that run Cloud Functions, the admin SDK finds the credentials on its own. We initialize it without a config:

const app = initializeApp()