Firebase Setup Install and configure Firebase in a Next.js project

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

OR


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

Firebase Setup

command line
npm install firebase react-firebase-hooks

Firebase Lib

Export common Firebsae SDKs and utilities.

file_type_js_official lib/firebase.js
import firebase from 'firebase/app'
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/storage';

const firebaseConfig = {
    // your config
};
  
if (!firebase.apps.length) {
    firebase.initializeApp(firebaseConfig)
}

export const auth = firebase.auth();
export const firestore = firebase.firestore();
export const storage = firebase.storage();

Optional

Consider setting up the Firestore emulator to work with mock data on your local machine.

Firebase Emulator PRO Video

Q&A Chat