Cloud Native / Serverless

Google Firebase Trims the Middle Tier for Faster App Dev

9 Jun 2016 8:25am, by

At the Serverlessconf conference in New York last month, Google engineers Mike McDonald and Frank Van Puffelen explained the secret sauce of the Google Firebase: Namely, that the app doesn’t need to query the database, instead it listens for change notices from the database itself.

“We’ve eliminated the middle-tier. Your clients talk directly to managed services,” McDonald said.

“Data stored in a Firebase database is retrieved by attaching an asynchronous listener to a database reference. The listener will be triggered once for the initial state of the data and again anytime the data changes,” the documentation states.

The software offers other advantages as well. Users don’t have to worry, for instance, if the database service is handled by a single machine, or a cluster. For them, it is an API to a database service that can scale to whatever the workload is, with the details abstracted away from the operator.

Firebase falls into the serverless technologies bucket, in that it eliminates the need to set up a lot of server-based infrastructure to run an app. But it offers a more tailored of services than Amazon Lambda, IBM OpenWhisk, or even the Borg’s own Google Cloud Functions.

Firebase was created earlier in the decade by two engineers, expanding on a integrated online chat service they had created. They found the service could also communicate other forms of application data as well. The two started a company in 2012, which Google purchased in 2014.

With project, “our goal was to remove middleware,” said Puffelen, at Serverlessconf. In a nutshell, Firebase is an integrated set of services that can be used to rapidly build  applications.

Google also sees Firebase as a gentle introduction to other, richer Google Cloud Platform services. The team is in the process of integrating Firebase with Google Cloud Platform services, in order to give developers an easy upgrade path as they, and their applications, grow more sophisticated.

“We want to scale as you scale, and as you build the apps and gain knowledge, you have this amazing on-ramp to a full set of infrastructure. A lot of it is server side, but a lot of it is serverless,” McDonald said. “Events just occur and you can react to them, and tie in the pieces that you need.”

So what can you do with Firebase? The primary service is the Firebase real-time database stores data as JSON strings and is synchronized in real-time to every connected client.

Various other specialized services have also been built from this base. Messaging is used to send out notifications, and for providing instant messaging for users. The Authentication service provides backend services, a software development kit, and ready-made UI libraries to authenticate users. Authentication can be done using passwords or with federated identity providers like Google, Facebook and Twitter. Firebase Storage can be used to store and serve user-generated content, such as photos or videos.

Firebase

Static webpage hosting, Remote mobile app configuration, Android app testing, and crash reporting are also available.

Ostensibly a platform for mobile development, Firebase can work for Android and iOS, as well as for Web applications, C++ applications, and server-based applications in general. The server app requires either Java SDK or the Node SDK on the server. From the Firebase console, you create a project and download a JSON file with your service account credentials, which you then place in your Web app/page. For Node.js:

var firebase = require("firebase");

firebase.initializeApp({
  serviceAccount: "path/to/serviceAccountCredentials.json",
  databaseURL: "https://databaseName.firebaseio.com"
});

At the conference, the duo demonstrated a sample photo analysis app that would display the Firebase capabilities.

McDonald snapped a photo of the audience with his smart phone, he then uploaded that photo to the Firebase storage. This action kicked off a Google Cloud Function function, which can be triggered by a change in an object story, or by a pub/sub notification. In this case, the function automatically called the Google Cloud Vision API, a service that can classify the photo in terms of subject matter, and then displays the results back.

This app was all composed  in fewer than 145 lines of code, including HTML, JavaScript, CSS and JSON code, McDonald said.

Firebase and the 10X Development Shop

Firebase is significant not just for offering a set of rapid development tools. It’s also a harbinger of how serverless services should work, observed Joe Emison, founder and chief technology officer at BuildFax (As well as a regular contributor to this website), in another talk at Serverlessconf.

“Firebase is an amazing tool. There is nothing out there that is like it. But you can’t think of it as a database. The microservices pieces that sit on top of it that enable you as a developer to do things very rapidly — it’s a great API, it’s really responsive — it’s much more like it’s a service that meets some needs of an organization,” Emison said.

Emison said he doesn’t believe in the 10x developer ( the developer who is 10 times more productive than his or her peers), but does believe in the 10x development shop. And the secret to these shops are rapid iterations, which will be a competitive necessity for businesses moving forward.

“10x development is about minimizing dependencies. Don’t make your developers wait for the database administrators or IT ops,” Emison said. “This is the context that I care about serverless in.”

Emison outlined an application he built using a set of tailored serverless technologies.

The site, CommercialSearch.com, which is a Zillow-for-commercial real estate search service, has about 300,000 unique visitors a month. Created in four months by two developers, it runs on about 13,000 lines of code. The bulk of the work is done by serverless services: Search is handled by Algolia, Cloudinary for image hosting. Firebase handles both the listings and the authentication.

Firebase serves as a proxy service, or a service customized to make some technology easier to use, Emison explained. In this case, it offers a tailored database management service. In a similar vein, Algoria is a proxy service for Elasticsearch.

Although many IT architects think of the middle tier as the core of development, much of today’s development is taking place at either the front-end. And the back-end tends to be handled by administrators. “I think the middle tier is going away. If we look to where we are going with software development, it’s about thick clients. It’s about mobile apps. It’s about single page apps. It’s about moving a lot of the processes to the client. The code we used to put in the middle tier is moving to the client,”he said.

What more general serverless services like AWS Lambda offer “is just a small part of what I need,” he said. He is looking more customized services that can lead to faster development, such as Firebase.

“I need Firebase way more than I need some place to execute code,” Emison said.

Google Firebase serving, as a service from Google has a three tier pricing model, a free tier for prototyping and hobbyists, a fixed priced model at $25 for predictable workloads, and commodity pricing for large-scale usage.


A digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.