Firebase Setup Add the Firebase SDKs to your server and frontend app

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.
Get Unlimited PRO Access

OR


*Enrollment provides full access to this course (and updates) for life.

Learn more about Firestore.

Server Firebase Admin Setup

command line
npm install firebase-admin

Download your service account, then add add it’s path as an environment variable.

file_type_config .env
GOOGLE_APPLICATION_CREDENTIALS="./service-account.json"

file_type_typescript firebase.ts
// Initialize Firebase Admin resources

import * as firebaseAdmin from 'firebase-admin';
firebaseAdmin.initializeApp();

export const db = firebaseAdmin.firestore();
export const auth = firebaseAdmin.auth();

React Firebase Setup

command line
npm install firebase reactfire
App.js
import { FirebaseAppProvider } from 'reactfire';

export const firebaseConfig = {
    // your config
};

ReactDOM.render(
  <React.StrictMode>
    <FirebaseAppProvider firebaseConfig={firebaseConfig}>
      <Elements stripe={stripePromise}>
        <App />
      </Elements>
    </FirebaseAppProvider>
  </React.StrictMode>,
  document.getElementById('root')
);

Questions?

Ask questions via GitHub below OR chat on Slack #questions