Setup Firebase 🔥


Go to the Firebase Console:

  1. Create a new project.

  2. Go to Firestore Database and create a new database.

  3. Go to Authentication and enable the Google, GitHub and email/password sign-in methods. Go to Authorized domains and add localhost and your production domain.

  4. Go to the Project Settings and scroll down to Your apps and create a new web app. Copy the config values into your .env.local file.

  5. Go to Settings > Service Accounts and generate a new private key. Save the JSON file and copy the values into your .env.local file.

Your .env.local file should look something like this:


# Firebase Admin (for firestore) - Get the values from the service account JSON file
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-........iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIIE.........Sw==\n-----END PRIVATE KEY-----\n

# Firebase (for client-side)
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaS.......Dym4tqfo
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=s...6.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=s...6
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=s...6.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=1...2
NEXT_PUBLIC_FIREBASE_APP_ID=1:10.........b295

Now you can sign-in with Google, or email/password!

Last updated Sat Aug 17 2024