Skip to content

Setup Firebase for your own Vercel instance

Jeffrey edited this page Jan 8, 2021 · 1 revision
  1. Create a Firebase project: https://console.firebase.google.com/

  2. Setup a Realtime Database and make note of the database URL (it's something like https://project-name.firebaseio.com/)

  3. Set the database rules to something like: Screen Shot 2021-01-06 at 3 21 35 PM

  4. 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.

  5. 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.

  6. Set the secret environment variable FIREBASE_PROJECT_ID to your project ID.

  7. Set the secret environment variable FIREBASE_DATABASE_URL to the Firebase database URL (from step 2)

  8. Set the secret environment variable FIREBASE_CLIENT_EMAIL to the client email.

  9. Redeploy your Vercel app.

Clone this wiki locally