Setting up cloud functions with firebase

This is optional. Use it only to run functions in the cloud

Start by activating cloud functions on firebase:

Functions in the cloud can be used for several reasons:

  1. You need a function that runs every now and then

  2. You need heavy actions that can be triggered by the client, but need to run on something bigger than a phone

  3. Higher security for actions made by users, for other user accounts

Open the terminal and paste in the following command:

git clone https://github.com/Shipswiftly/Firebase_cloudFunctions/blob/main/functions/index.js

The cloud functions available are only two: One to check user membership, and another one to verify the token from the user to authenticate OpenAI requests. (Can be used for any other service your app requires)

Run the following commands to log in to firebase and to upload your functions to the cloud:

Required Installation:

npm install -g firebase-tools

Login to your firebase account from the terminal:

firebase login

Deploying all the functions to remote:

firebase init functions
firebase deploy --only functions

Last updated