Firebase Setup

Add the Firebase SDKs to your server and frontend app

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? Let's chat

Open Discord