Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How to use Google Firebase to build real-time IoT apps

Google Firebase helps developers build real-time applications for the Internet of Things but is not without limitations.

Internet of Things developers share a lot of common implementation requirements across a wide range of IoT applications. Collecting data, delivering low latency content, and securing communications between devices and back-end services are just three of those common needs.

While meeting common needs can be challenging at times, IoT development platforms such as Google Firebase provide services that allow developers to meet many of these requirements.

Benefits of Google Firebase

The Firebase platform as a service includes a NoSQL document data store. Applications store data as JSON objects and interact with the database using a JavaScript API. Mobile developers have the option of using Android or iOS APIs, too. The data store is designed to scale with application demand, so there is no need to add servers, partition data or perform other database administration that comes along with maintaining your own database back end.

The RESTful API includes query operations but not SQL operations. The query API is tailored to work with channels of data. For example, the "on" operation listens for changes in location and invokes a callback function if a specific event occurs. There are also query operators with SQL-equivalents, such as orderByKey, orderByValue and orderByPriority. The limit, limitToFirst and limitToLast query operations can restrict the number of JSON documents returned by the query.

In addition to storing dynamic data in the Firebase data store, developers can store static content that may be needed in the application on Firebase's hosted service. The process of provisioning static content storage is the same as setting up a website; Firebase will validate domain ownership, provision an SSL certificate and deploy it across the Firebase content delivery network. Finally, domain name service records will need to be updated to map the domain name to your hosted site.

Another advantage of Firebase is that it provides support for offline operations. Database operations are written locally and synchronized with the Firebase database when network connectivity is established.

Google Firebase includes controls to protect data in motion and data at rest. Data is transmitted using SSL/TLS 2048-bit encryption, and within the database, users are authenticated and can be restricted to certain operations using a set of security rules. Firebase authentication uses either an existing login server or client-side code. Firebase supports usernames/password logins as well as social login services such as Google, Twitter and Facebook. Custom code can also be used if you prefer to generate your own tokens.

Once users -- or in the case of IoT, devices -- are authenticated, security rules control the operations they can perform and the data they can access. Security rules support read/write operations, as one would expect, as well as a validate operation. This is used to specify the proper format of a data element and its data type. New applications by default grant full read/write access to the database; developers must be sure to update security rules to limit the operations and scope of data a device can manipulate. Attackers can take advantage of excessive or elevated privileges to compromise the integrity or confidentiality of data in the data store.

Google Firebase offers six pricing tiers for its services: Free, Spark, Candle, Bonfire, Blaze and Inferno. Sans Free tier, pricing ranges from $5.00/month for Spark to $1,499.00/month for Inferno. Tiers three through six all include support for unlimited real-time database connections and users, as well as 1 TB data hosting transfers. The most substantial differences between tiers are seen in real-time database storage capacity and transfer allowances. Spark, for example, offers 1 GB of storage and 10 GB of transfers while Inferno, the highest tier, gives 300 GB of storage space and allows up to 1.5 TB of transfer data. The top three tiers also offer a private backup option to customers.

Google Firebase drawbacks

Firebase is especially useful for data-intensive IoT applications that can make use of a Javascript API to access data and security services. However, developers should look to other tools to supplement back-end functionality of their IoT application. Basic server side processing is available, but more advanced analytics will require loading IoT data to another platform, such as Hadoop or Spark.

Another drawback is that the query functionality of Firebase is limited. If more advanced query functions are required, consider exporting data to an Elasticsearch server or cluster for more search options. In addition, if visualizations and alerts are important when monitoring a data stream, consider tools such Kibana, a visualization for Elasticsearch data.

About the authors:
Dan Sullivan is an author, systems architect and consultant with over 20 years of IT experience with engagements in advanced analytics, systems architecture, database design, enterprise security and business intelligence.

James Sullivan is a technology writer with concentrations in cloud database services, IoT and security. He is based out of Portland, OR.

Next Steps

Cloud giants are hoping to win over developers with IoT cloud services

Google joins the cloud battle with Firebase

When should developers use DBaaS?

This was last published in March 2016

Essential Guide

A comprehensive guide to enterprise IoT project success

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

How will Google Firebase affect enterprise IoT app development?
Cancel

-ADS BY GOOGLE

SearchCIO

SearchSecurity

SearchNetworking

SearchDataCenter

SearchDataManagement

Close