-
Notifications
You must be signed in to change notification settings - Fork 47
Setup Firebase for your own Vercel instance
-
Create a Firebase project: https://console.firebase.google.com/
-
Setup a Realtime Database and make note of the database URL (it's something like
https://project-name.firebaseio.com/
) -
Set the database rules to something like:
-
Navigate to the Service Accounts tab in the Firebase project settings and click Generate private key. This will download a JSON file. In the JSON file you'll find the project ID, private key, and client email.
-
Base64 encode the private key (it's ok to keep all the newlines):
$ echo "-----BEGIN PRIVATE KEY-----(...)-----END PRIVATE KEY-----\n" | base64
In Vercel, set that as the value of the secret environment variable
FIREBASE_PRIVATE_KEY_B64
. -
Set the secret environment variable
FIREBASE_PROJECT_ID
to your project ID. -
Set the secret environment variable
FIREBASE_DATABASE_URL
to the Firebase database URL (from step 2) -
Set the secret environment variable
FIREBASE_CLIENT_EMAIL
to the client email. -
Redeploy your Vercel app.