How to Rotate an Image Infinitely Using Only CSS

Rotating an element in HTML using CSS is pretty simple, really. Add the following CSS to the element that you want to rotate. animation: spin 2s infinite; Now, in the same CSS file, create a @keyframe @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } Combining all this into one block, […]

Create User Profile in Firestore After Authentication in Firebase


When a user signs up for your app, Firebase creates their profile in Firebase Authentication. This is great because most of the hard stuff like OAuth and validation is being handled automatically for you. This, however, has its limitations. Auth doesn’t let you store any custom properties to the user and this is very limited […]

How to Split Firebase Cloud Functions for Better Code Organization


Often times, you may hear that for Node.js development, the code logic should be separated into different modules. This is logical and obviously the best practice whenever you are writing code for the real world. In Firebase Cloud Functions, you can also do that. From your index.js file, simply require() the function from another file and use its reference to […]

Get All Users From Auth in Cloud Functions for Firebase


To get all the users from auth in Firebase, you can use the Admin SDK for Firebase. It gives you elevated privileges to perform operations in the system that a normal user can not. The Admin SDK comes with a lot of functionality built-in. But, the one thing that we care about here is Managing Users. Getting Users […]

How to Import Large Amount of Data to Cloud Firestore


Firestore has been out of beta for some time now. But it still doesn’t support import or export functionality natively. This is a big downer for someone wanting to use the native functionality of the Firebase platform. Keep in mind that when I talk about enabling exports/imports, I’m talking about the firebase-admin SDK. Export/Import via the gsutil command-line utility is […]

Get All Dictionary Keys in Firestore Using Firebase Cloud Functions


In Firebase, you can get all the keys of an Object very easily. The thing that you should note is that a dictionary is just an Object in Firestore. All the custom Objects that you store in the Firestore behave just like the native Javascript objects. To get all keys of an object, you can simply use the Object.keys() method that is available for […]

Protect Firebase Cloud Functions From Unauthorized Access


In this tutorial, I’ll show you how you can protect your https cloud functions from unauthorized users in Firebase. By restricting unauthorized users, you can save resources and thus decrease the overall cost of your app. Setting Up The Project Using the command-line, initialize the Firebase project as follows: $ mkdir cf-auth $ cd cf-auth […]

How to Enable CORS in Node.js Without Express CORS Middleware

It’s very easy to simply install the cors middleware to handle all the CORS stuff while using Node.js as your backend. This, however, leaves you with a very superficial understanding of how the Cross-Origin Resource Sharing mechanism works. In this article, we will add CORS to a very simple http server in Node.js without using Express or […]

How to Get Server Timestamp Using Firebase Cloud Functions


In this tutorial, we are going to create a Cloud Function which will return the server timestamp. Getting the Firebase Server Timestamp If you only care about the timestamp and not what format it comes in the result, this method is for you. You can simply create an endpoint in your https API which will […]

How to Enforce Unique Field Values in Cloud Firestore


The Cloud Firestore is an awesome platform for quickly prototyping your app ideas into reality, however, it certainly comes with some limitations. Currently, there is no way for you to enable uniqueness in field values in the whole database. There is a quick workaround, though with queries that you can use. The Problem You want […]