You're viewing the legacy docs. They are deprecated as of May 18, 2016.
These docs are for version 2.4.2 and below of the Javascript SDK. Go to our current docs, or see our Web migration guide.

JavaScript Web Guide

Installation & Setup

Create an account

First sign up for a free account. A new Firebase app will be created for you. This includes a unique database URL ending in firebaseio.com. You'll use this URL to store and sync data.

Within the App Dashboard you can create, manage and delete Firebases apps. Clicking on a specific Firebase app lets you view and modify your app's data in realtime. In your app dashboard, you can also set Security and Firebase Rules, manage your app's authentication, deploys, and view analytics.

Install Firebase

Next, you'll need to include the Firebase JavaScript client library in your website. Simply add a script tag to the <head> section of your HTML file. We recommend including the library directly from our CDN:

<script src="https://cdn.firebase.com/js/client/2.4.2/firebase.js"></script>

Alternatively, if you prefer to install Firebase as a local application dependency, you can use Bower:

$ bower install firebase

Running a Web Server

To view your files on your local machine, you still need to start a web server. You can start one by running:

$ npm install -g serve
$ serve

Node.js Setup

The Firebase JavaScript API and the Firebase Node.js API are exactly the same. Firebase clients run just as easily on your servers as they do on end-user devices. We offer a Node.js module which can be installed via npm from the command line:

$ npm install firebase --save

To use the Firebase Node.js module in your application, just require the Firebase client library.

var Firebase = require("firebase");

That's it! Now we're ready to start reading and writing data with a Firebase database, which we'll cover in the next section.

  1. 1

    Next

    Installation & Setup

  2. 2

    Next

    Understanding Data

  3. 3

    Next

    Saving Data

  4. 4

    Next

    Retrieving Data

  5. 5

    Next

    Structuring Data

  6. 6

    Next

    Understanding Security

  7. 7

    Next

    User Authentication

  8. 8

    Next

    Offline Capabilities

  9. 9

    Next

    Deploying Your App