We have two big feature announcements: Google Login, and an entirely new version of the Firebase command-line interface.
Google Login
Many of you have asked for more security on your Firebase account. Starting today, Google Login is the default authentication for firebase.com. If you have an existing Firebase account you’ll have the option of migrating to Google Login when you log in to your Firebase account. If you don’t have a Firebase account yet, you’ll be prompted to create one with Google Login.
This means you’ll have access to new security features, like two-factor authentication and Google account recovery. As we work on integrating with more Google services, Google Login will ensure you get access to new features.
CLI 2.0.0
In May of 2014, we introduced Firebase Hosting - production-grade hosting for developers. With our CLI, developers could deploy static content with one command: firebase deploy
. Since releasing the CLI, we’ve received a lot of feedback from our developer community and with today’s 2.0.0 CLI release, we’re excited to add several new features. We’ll outline the highlights below, and you can dive into the docs for all the details.
Start a local server
You can now start a static web server for your Firebase content by running the command:
firebase serve
This local server will respect all of your app’s configuration rules defined in firebase.json
.
Read and write data
With today’s release, you can read and write data from your Firebase database directly from the CLI. The new data:get
command lets you specify a file to output the resulting JSON, or logs it to the command line. Similarly, with data:set
you can import a JSON file to your Firebase database or write data directly from the CLI. Let’s say we have the following new-users.json
file that we’d like to import to our Firebase database at the top-level /users
path:
{
"alanisawesome": {
"date_of_birth": "June 23, 1912",
"full_name": "Alan Turing"
},
"gracehop": {
"date_of_birth": "December 9, 1906",
"full_name": "Grace Hopper"
}
}
To write this to our database from the command line, we can now run:
firebase data:set /users new-users.json
In addition to reading and writing data, you can also run the commands data:update
, data:push
, and data:remove
. See the documentation for details.
Run commands programmatically
All CLI commands can now be run programmatically by requiring the firebase-tools module via Node.js. Commands can also be run with a flag to output JSON. For instance, if you want to retrieve a list of the Firebases for your account:
var client = require('firebase-tools');
client.list().then(function(result) {
console.log(result);
});
These are just a few of the new features that shipped with CLI 2.0.0. Check out the docs for the full details.
Get Started
We’ve been working hard on these new features and we’re excited for you to try them out! To enable Google Login, log in to your Firebase account and follow the steps outlined in your account dashboard.
To install the latest version of firebase-tools, run:
npm install -g firebase-tools
Check out the documentation for a full list of new CLI features, and let us know what you think by submitting a GitHub issue or pull request.
Happy coding!