Preparations
First of all you have to create Firebase project in Firebase Console, for more informations about Firebase project you can learn more here. In this tutorial I will be using Node.js environment. You can check the supported Node.js version for Firebase here.
Now, I assume that you already create the Firebase project and have Node.js environment installed. Next step is you need to install the firebase CLI using:
Initialize local Firebase Project
After that, login into Firebase.
Next, go to your local Firebase Project directory and initialize the firestore and cloud functions.
firebase init firestore
firebase init functions
Creating and Emulating the Cloud Functions
After that, Import required modules and then initialize the app inside your index.ts file.
admin.initializeApp();
Now, you can create your public Firebase cloud functions using functions.https.onCall() and functions.https.onRequest() callback functions that can be used over https call inside your index.ts file.
Next, start the Firebase cloud function emulator in local environment using:
Check the output of this command to get the URL format to call the cloud functions it will be looks like this:
http://localhost:5001/MY_PROJECT_ID/us-central1/
The port may be vary according to your local machine environment.
Deploying Firebase Cloud Functions
Deploying Firebase cloud functions to productions is a quite simple process you can just directly run this command:
Congratulation! You have successfully creating and deploying your Firebase cloud functions, now you can access the cloud functions that you have created to your React application. If you don't have any React application yet you can follow this tutorial to create a React application using typescript and tailwind css.