A Look at the New Firebase: A Powerful Google Platform

The new Firebase has more features than you can shake a stick at.

The new Firebase announcements made at Google I/O 2016 really make Firebase a first-class citizen in the Google ecosystem. Firebase is bringing together all of Google's best offerings and packaging it into a clean and easy-to-use package.

Firebase went from 110,000 developers when it was first acquired by Google in October of 2014 to 450,000 developers currently. You can bet with the announcements at I/O, that number will skyrocket even further, especially with the new Android and iOS mobile centric features.

There was a Firebase coup over at Google. They are now the combination of so many of Google's best services.

We're big fans of Firebase here at Scotch and have written a Real-Time Scheduling App using AngularJS and Firebase in the past. We're looking forward to creating some more apps and using it for some of our production level sites.

Here's a quick video that gives a neat overview of the features:

Congrats to James Tamplin, David East, and the entire Firebase team for this massive announcement.

Let's take a look at the following:

  • What this upgrade means for developers
  • The upgraded and the new features
  • The simple pricing
  • What this means for mobile
  • What this means for cloud
  • The future

Strap in for a long article; Firebase announced a ton of awesome stuff.

What the Upgrade Means For Developers

Firebase isn't just a backend as a service anymore. It's THE developer backend to use for Google services.

It can't be understated how important this shift is for Google and for Firebase. They provided a simple and unified platform with so many of the best Google features packed in.

When creating our apps, we as developers need to go and grab a bunch of different services to create what we want. Here are the things that can now be replaced when creating our apps:

  • Google Analytics (built into Firebase for free)
  • Site Hosting (any hosting)
  • Global CDN (Cloudflare, CloudFront, or MaxCDN)
  • Storage (S3)
  • AdSense for ads (built into Firebase)
  • Cloud/Realtime Messaging/Notifications (Pusher)
  • More

All of the above can now be implemented when using Firebase. One platform for all of that goodness. That's a lot of time saved so that we can focus on the actual things that make our apps/sites unique.

Let's take a look at the features and walk through the new material design site.

A Massive Number of Features

Not only is this a massive upgrade in the features that are provided, Google went all-in on Firebase and showed the fruits of their acquisition just 18 months ago.

Firebase is all of Google's strengths wrapped into a neat platform for developers.

Check out the shiny new Firebase website with the new logo:

Firebase can now be seen as the glue that brings together so many of Google's offerings. With Firebase, analytics are now free and built-in. Ads can also be easily taken advantage of.

All of this from a single SDK, with a single dashboard, and one place to go for documentation.

Here's the list of the features:

  • Realtime Database
  • Hosting
  • Authentication
  • Storage
  • Cloud Messaging
  • Remote Config
  • Test Lab
  • Crash Reporting
  • Notifications
  • App Indexing
  • Dynamic Links
  • Invites
  • AdWords
  • AdMob

Let's go into these in more depth.

Upgrades to the Current Features

This is a giant showing and the fact that Firebase now incorporates so many features is going to make development life easy for the users that want to take advantage of some or all of the features.

Firebase has had three features (realtime database, authentication, and hosting) for a long time now and they're a blast to play around with, especially realtime database.

Realtime Database for Realtime Apps

Easily sync information across all your users. We built a demo to show off the realtime database.

When we click one of the scheduling times, we can see our database change in the Firebase dashboard. All in realtime. Fun stuff.

It's important to note that this app was made on the old Firebase dashboard. With one click, I was able to bring it over to the new dashboard, no coding changes required.

Here's some code to see how easy it is to use data from the Firebase realtime database:

// Get a reference to the database service
var database = firebase.database();

// picking a user id at random for demonstration
var userId = 1;

// save a user to our /users database
firebase.database().ref('users/' + userId).set({
  username: 'Chris Sevilleja',
  twitter_username: 'sevilayha',
  email: 'chris@scotch.io'
});

// get that user
database.ref('users/' + userId).on('value', function(user) {
  console.log('The user is ' + user.username + '!');
});

No need to create your own database, create your own API, and handle all that stuff that usually comes with creating a backend for our applications. Firebase realtime database handles that for us.

The docs give a great overview and samples of how to use the realtime database on Android, iOS, and for the web. Also, give our Firebase articles a try.

Authentication: Email/Username and Social

Authentication can be handled both for username/email/password and for social authentication. You can see your users in the dashboard:

You can also handle social authentication by simply enabling it from the dashboard:

The authentication side of things got one of the biggest upgrades. New SDKs, upgraded backend infrastructure, and more. Email verification and account linking have been added.

Here's some code to handle social authentication with the new SDK:

// grab the twitter auth provider
var provider = new firebase.auth.TwitterAuthProvider();

// do the login
firebase.auth().signInWithPopup(provider).then(function(result) {

  // twitter token and secret you can use to contact the twitter api
  var token  = result.credential.accessToken;
  var secret = result.credential.secret;

  // user info
  var user = result.user;

}).catch(function(error) {

  // blah blah errors

});

Be sure to take a look at the Firebase Authentication docs.

Hosting: App/Site Hosting with Extras

Hosting was always a simple process in Firebase. Now there are new features like:

  • Custom domain support for free
  • Global CDN
  • Auto-provisioned SSL certs

Once the Firebase CLI is installed and setup, you can easily deploy your applications.

# install the CLI
npm install -g firebase-tools

# login
firebase login

# start a project
firebase init

# run locally
firebase serve

# DEPLOY!
firebase deploy

It's that easy to get your app/site hosted.

The New Features

This is where the insanity starts. Firebase's scope went through the roof. The vision Google had when they acquired Firebase eighteen months ago is starting to become clearer.

A Clean Dashboard

With all the new features, the dashboard had to change to reflect all the new things. As with all things Google, Material Design was brought in and the dashboard is a clean with its left sidebar of all the features.

Here's a look at the old vs new dashboards also:

The new dashboard has quick access to all the features you'll need right in the main sidebar:

Built-In and Free Analytics

Built-in and free for all Firebase apps is a strong analytics suite that takes a page from Google Analtyics.

Geared towards mobile developers, the analytics allows us to:

  • See what users are doing in our applications
  • See how ad campaigns are performing
  • Attribute different networks
  • Create Audiences to define and track groups of users based on defined criteria

Since Firebase uses the same systems as Google Cloud Platform, Cloud products can be used with our Firebase app and its data. Need advanced querying? We can export data to BigQuery.

Here's some code to log an event in an Android app. Events can then be analyzed in your dashboard.

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);

You can take a look at more of the events that can be logged in the analytics docs and the Android analytics docs.

Store Files Through the SDK

Firebase now has the ability to host our files and upload them through the SDK.

This effectively means that we don't have to go around creating a storage account elsewhere, like AWS S3.

Here's some simplified code to handle the upload through the SDK:

// grab our references
var auth       = firebase.auth();
var storageRef = firebase.storage().ref();

// function to handle file upload
function handleFileSelect(event) {
  // grab the file
  var file = event.target.files[0];

  // create the metadata
  var metadata = {
    'contentType': file.type
  };

  // push the file
  var uploadTask = storageRef.child('images').put(file, metadata);
}

// sign the user in when the page loads
// storage can only be used if signed in (can be anonymous signin)
window.onload = function() {

  // Sign the user in anonymously since accessing Storage requires the user to be authorized.
  auth.signInAnonymously().then(function(user) {
    console.log('Anonymous Sign In Success', user);
  }).catch(function(error) {
    console.error('Anonymous Sign In Error', error);
  });

}

In the above example, we have handled authentication and uploading a file. Then we can see all our files in our singular dashboard.

Securing Files Easily

The security model for the Storage SDK is similar to the security that the realtime database offers. It's mad easy to secure files against actual users. Other providers will make you manually register ARMs and ACLs and then map those to users.

"It's mad easy to secure files against actual users." - David East

Remote Configuration Variables for Apps

Instantly update variables for your applications. This means that you won't have to wait for a long deploy process to get new data into your applications. Enable or disable features, change out the theme, and more without having to publish a new version of your application.

Think of these as settings that you control like an app overlord sitting in your tower (Firebase Dashboard).

Once you set a variable in the dashboard, you'll be able to grab it using:

config.getBoolean('holiday_promo_enabled');

Be sure to check out the docs and the following video for more information:

Test Lab: Test Apps Across Android Devices

Geared towards Andorid apps, the Test Lab allows for testing across the large number of Android devices out there. All those devices, shapes, sizes, screens. It's good to be able to see:

  • logs
  • videos
  • screenshots

All from within your Firebase Console.

Read more on the official Test Lab docs;

Cloud Messaging

Firebase Cloud Messaging (FCM), which was previously Google Cloud Messaging is available for free and at no cost. Send out notifications to your users no matter what device they are on. FCM already sends 170 billion messages per day to 2 billion devices so it already has an answer to the popular question: "but can it scale?".

There's a bit more code involved here since there is setup required on all the different types of apps you will be creating. Be sure to check the Cloud Messaging docs.

Crash Reporting: In Dashboard Error Reports

Get prioritized, actionable reports to help you diagnose and fix problems in your iOS and Android apps after they have shipped. Crash Reporting is also connected to Audiences in Firebase Analytics so you can do a deep dive into which types of users are running into crashes on which devices.

With cloud reporting, you'll be able to:

  • monitor fatal and non-fatal errors
  • collect the data you need to diagnose problems
  • integrate with Analytics

Notifications: Send Messages To All Users

Manage and send notifications to users using the above-mentioned Firebase Cloud Messaging. Using the dashboard, you can talk to your users, reengage them, and more.

Firebase Notifications also offers analytics for who uses and dismisses your notifications.

Dynamic Links for App Installs

A functional way to navigate your users around your mobile apps. Links survive app installs so they will persist the install process and your users won't be lost in the shuffle.

Dynamic Links also work across any devices, iOS, Android, desktop and mobile web. Users that click links will be taken to the Play Store or App Store if the app isn't already installed.

AdMob: Monetize Your Apps

Monetizing is one of the main things developers need to do aside from well... developing. Most of us aren't building these amazing things for free! Revenue tools are built into Firebase and leverage all of Google's considerable knowledge with ads.

AdMob is a mobile ad platform with targeted, in-app advertising. It also works with Firebase Analytics to provide app usage and ad data.

Some of the Best Documentation Around

As you've seen throughout this article, there are links to the documentation all over the place. Easy to navigate and with lots of code examples, the Firebase team knows that documentation is one of the biggest reasons a platform will succeed.

Give the docs a read through for whatever platform you're on (iOS, Android, Web, or all of them!).

The samples section is also a great place to look to see if Firebase is the right fit for what you're goig to be building.

Simple Pricing: Who Doesn't Like Free?

With three pricing tiers, Firebase has greatly simplified a boatload of tools into one platform at simple price points.

  • Spark (Free): Great price to tinker around with Firebase applications. Some of my fun side projects are on the free tier including our scheduling demo.
  • Flame ($25/mo): A ton of value for $25/mo. Should hold a lot of developers until their apps grow to a much larger size.
  • Blaze (Pay as you go): Pay as you go for larger apps

All of the pricing tiers come with the following for free:

  • Analytics
  • App Indexing
  • Authentication
  • Dynamic Links
  • Invites
  • Notifications
  • Crash Reporting
  • Remote Config

It's brilliant that they can offer so many services that you would've had to piece together and pay for separately under one roof. I'd be interested to see comparisons by anyone that has a current app that would fall under the Blaze plan. How does that pricing compare to what you're currently paying?

The Mobile Play: A Backend for Mobile Apps

With Google pushing Firebase for mobile development now, you can bet there will be a huge uptick in the number of users signing up for their mobile app backends.

Firebase has done a great job handling so much of our applications as developers. Things like the following were very easy to handle:

  • Having a Realtime Database
  • Authenticating Users
  • Hosting sites/apps

Now with a plethora of new features, mobile developers can allow Firebase to handle the majority of the busy work with their apps:

  • Notifications
  • Cloud Messaging
  • Analytics
  • Ads
  • Crash Reporting

Those are just some of the great features mobile developers can now leverage. What does this mean for Firebase? With the Play Store and App Store growing every month, that's a lot of developers that can leverage this Firebase's backend-as-a-service.

Firebase jumped from 100,000 users when it was acquired in October 2014 to 450,000+ this month. With this set of mobile centric features, I can only imagine how much larger their userbase will grow. Very exciting stuff for the great team over there.

The Cloud Play: An Easy-to-Use Platform

While there are many people in the cloud game (AWS, Azure, Heroku, Google Cloud Platform, and more), it's still relatively early on. There are many companies that can still make the switch, so the battle rages on for cloud dominance.

Many people like Azure for its clean interface. Many like Heroku for its simplistic setup. Others like AWS because of its giant array of tools and how they all work together. I don't know much about Google Cloud Platform except that when I first used it, it wasn't going to win any beauty contests. That's greatly changed since they upgraded so I'll have to take a further look.

Firebase is like all the strengths of so many cloud hosting services wrapped into one neat and clean package.

Now with the new Firebase, we get a new kind of player in the cloud hosting and services game. The benefits provided give it great positioning in this cloud game market:

  • Clean packaging and dashboard
  • Simple pricing
  • A large amount of features
  • Mobile centric
  • One SDK
  • Easy to understand docs

Firebase is Google's secret weapon in the cloud and mobile game. Firebase can be seen all over the Google I/O 2016 schedule and for good reason. It's the forward facing future of Google's cloud platform.

Conclusion

Overall, a very forward thinking upgrade, especially in the mobile and cloud space. I might seem excited about the things Firebase announced; that's because I am.

I do still plan on writing my own Node and Laravel APIs and backends. Handling my own databases and realtime messaging. But I will also be integrating Firebase more into my apps depending on the project. I can only spend so much time writing similar APIs when starting new projects.

Really great group of announcements and features. Feels like a Firebase coup. Their scope is giant and I'm excited to see what the future holds for Google Cloud and Firebase.

Chris Sevilleja

Co-founder of Scotch.io. Slapping the keyboard until something good happens.