Firebase Utilities: A Firebase wrapper that joins several paths either as a union or intersection of the merged data sets.
Pull request Compare This branch is 172 commits behind firebase:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a collection of power toys (mostly experimental) for use in Firebase. Right now it consists of one library.


  • Firebase.util.join Sync to multiple Firebase paths and seamlessly merge the data into a single object. You can use most of your favorite Firbebase methods (on, once, set, etc) normally. The merged data is distributed back to the responsible paths during set/update/remove ops.



On the web:

<script src=""></script>
<script src="firebase-util.min.js"></script>

   var ref = Firebase.util.join( new Firebase(PATH1), new Firebase(PATH2), ... );
   ref.on('child_added', function(snap) { console.log(snap.val()); });

In node.js:

var Firebase = require('firebase');
var FirebaseUtil = require('./firebase-util.js');
var ref = FirebaseUtil.join( new Firebase(PATH1), new Firebase(PATH2), ... );
ref.on('child_added', function(snap) { console.log(snap.val()); });

Global Utilities


Log debugging info to JavaScript console (or command line in node.js). Defaults to 'warn' (errors and warnings). This can be set or changed at any time to any of the following:

Firebase.util.logLevel(true);  // default logging (also accepts 'all' or 'on')
Firebase.util.logLevel(false); // all logging off (also accepts 0, 'off' or 'none')
Firebase.util.logLevel('error'); // error, warn, info, log, or debug

Debugging can also be enabled in the browser by adding debugLevel=x into the url's query parameters. This allows one to turn on debugging for quick troubleshooting without having to modify any code.

The logLevel() method returns a revert function that can be used to restore the logging level to it's previous value:

// log a whole lotta junk
var revert = Firebase.util.logLevel('debug');

// some code...

// revert to default logging

You can also filter log output with a RegExp:

// only print logs that begin with "Path"
Firebase.util.logLevel('debug', /^Path/);



If you don't have Grunt installed, do it like so

npm install -g grunt

Fork this project into your own GitHub repo

git clone
cd firebase-util
npm install

Declare environment variables for testing. In Mac/Linux:


(For DOS use set VAR=value, for PowerShell, use $env:VAR=value)

Set security rules on your development Firebase as follows:

  "rules": {
    ".read": " !== null",
    ".write": " !== null"

Make project, monitor for changes, and automagically run test units:


Best Practices

Read the under src/ for an overview of the standards, code structure, and utilities for development.


Add test cases to cover any new code you create. Make sure all test cases pass before committing changes. You must declare FIREBASE_TEST_URL and FIREBASE_TEST_SECRET first. (see setup).

You can run all test units at any time using grunt test or automagically after changes by using grunt watch.

Read the under test/ for details about test standards, structure, and helper methods.

Committing changes

See Using Pull Requests.

Before submitting your pull requests, make sure your code meets the following criteria:

  • all test units for all packages must pass (100% success rate)
  • all public methods in your package must include a complete set of test cases
  • must be complete and include summary, examples, and API details