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:

ShipNow
1
2# Firebase Admin (for firestore) - Get the values from the service account JSON file
3FIREBASE_CLIENT_EMAIL=firebase-adminsdk-........iam.gserviceaccount.com
4FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIIE.........Sw==\n-----END PRIVATE KEY-----\n
5
6# Firebase (for client-side)
7NEXT_PUBLIC_FIREBASE_API_KEY=AIzaS.......Dym4tqfo
8NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=s...6.firebaseapp.com
9NEXT_PUBLIC_FIREBASE_PROJECT_ID=s...6
10NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=s...6.appspot.com
11NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=1...2
12NEXT_PUBLIC_FIREBASE_APP_ID=1:10.........b295

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

Last updated Sat Aug 17 2024