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


*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 Firebase 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) {

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


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

Firebase Emulator PRO Video

Q&A Chat