Firebase Configuration
Register for an Account
Create a New Firebase Project
-
Creating a new project in Firebase.
-
Once you have a new project open on Firebase it'll look something like this
Copy Firebase Config Environment Variables
Click on the web button here as pictured below:
You will be asked to give your app a name, name it whatever you like (eg. "MySaaSProject", or your product's name if you have one.)
This project is setup to be hosted on Vercel, not Firebase hosting. Leave it unchecked for now unless you specifically want to host it on Firebase
Next you will be directed to the Add Firebase SDK screen, it will show you your Firebase Config, these values need to be added to the .env.local
file.
Copy paste each value that I've blacked out and move it into its respective variable in the .env.local
file.
Enable Authentication and Firestore
Next you'll want to enable Auth and Firestore in Firebase. To do that just click on the Authentication option in the sidebar menu on the left.
And click the Get Started
button on the page
We'll start by enabling Email/Password Auth since it is aleady implemented in SaaSavant.
Select Email/Password
under the Sign-in method tab of the authentication page. toggle the Enable
checkbox.
Now Click Save
.
Choose a public facing name for you project (Your users will see this, just name it your app's / company's name) and configure a support email for the project (optional).
Auth is done, now it's time to setup Firestore. From the left side menu, click on Build
and click on Firestore Database
.
Click the Create Database
button
Set the location to the most appropriate location for your users (or just leave it on the default)
Start in production mode
and click the Create
button
Go to the Rules
tab and set the following rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users collection
match /users/{uid} {
allow read, write: if true;
}
match /announcements/{id} {
allow read, write: if true;
}
match /newsletters/{id} {
allow read, write: if true;
}
match /supportTickets/{id} {
allow read, write: if true;
}
match /waitingList/{id} {
allow read, write: if true;
}
// Customers collection
match /customers/{uid} {
allow read: if true;
match /checkout_sessions/{id} {
allow read, write: if true;
}
match /subscriptions/{id} {
allow read: if true;
}
match /payments/{id} {
allow read: if true;
}
}
// Products collection
match /products/{id} {
allow read: if true;
match /prices/{id} {
allow read: if true;
}
match /tax_rates/{id} {
allow read: if true;
}
}
}
}