Saturday, October 21, 2017

Why we need firebase cloud functions ?

What is firebase ?

Firebase is the google cloud platform to build IOS, Android and Web apps. It takes care the infrastructure and backend for the app.

Following are the few important service that firebase provides.

1) Realtime Database
2) Authentication
3) Static Hosting
4) Cloud functions
5) Analytics
6) Storage

Why cloud functions ?

App can directly contact the services provided by firebase.
For ex: Your app can directly contact the realtime database for storing and retrieving data. This is called Database As Service.
You don't need to write your backend authentication logic as you can directly use the firebase authentication service to create, update and delete user. Firebase has support for Google, FB, Twitter, Github and normal email/password user login.

However if you want to perform certain actions when the event occurs from firebase features then you need the cloud functions.
Firebase cloud functions will listen to the events and trigger the custom functions.
For ex: If you want to send an welcome email once user is created you can write a cloud function which will listen to user creation and send an email when a new user is created.
You can move the client side logic which responds to the actions to the cloud functions so that same logic wont be repeated in your mobile and web app.
Third party API integration is now centralized using cloud functions.
Cloud functions works as a backend for your app.
You are actually not maintaining any backend server though google is running these functions in its own server. This is called serverless architecture.

Firebase cloud functions can respond to events generated by the following Firebase and Google Cloud features:

1) Cloud Firestore Triggers
2) Realtime Database Triggers
3) Firebase Authentication Triggers
4) Google Analytics for Firebase Triggers
5) Cloud Storage Triggers
6) Cloud Pub/Sub Triggers
7) HTTP Triggers


* Check the following article to create your 1st cloud function using firebase tool which will listen to the HTTP event.

http://www.fullstacktechnos.com/2017/10/introduction-to-cloud-functions-for.html


More Article :
http://www.fullstacktechnos.com/2017/10/firebase-authentication-service-for-web.html


No comments:

Post a Comment