Firebase Data Structure

When a new Firebase is created, it is assigned its own unique hostname. For example, if you were to create a Firebase for your SampleChat application, it could live at:

https://SampleChat.firebaseIO-demo.com/

Every piece of data inside your Firebase is addressable by URL. For example, here's a depiction of a SampleChat Firebase with a title and two users:

SampleChat Data Structure

We refer to these URLs that point to data as locations. Firebase locations can store strings, numbers, booleans, or nested children.

Nested children allow you to structure your data hierarchically. For instance, SampleChat has a list of users, which are located at:

https://SampleChat.firebaseIO-demo.com/users

The data for users 'fred' and 'jack' is stored at these nested locations:

https://SampleChat.firebaseIO-demo.com/users/fred
https://SampleChat.firebaseIO-demo.com/users/jack

In this example, 'fred' and 'jack' are said to be children of 'users', and 'users' is said to be the parent of 'fred' and 'jack'. Note that Firebase locations can contain either data (a string, number, or boolean) or children, but not both.

Locations for data can nest as deeply as you like. For example, the last name for user 'fred' is located at:

https://SampleChat.firebaseIO-demo.com/users/fred/name/last

When creating a new nested Firebase location, any parents which don't currently exist will be automatically created. If you want to add another user, you can set the following path to the string 'Mike' and the parent locations '/users/mike' and '/users/mike/name' will be automatically created.

https://SampleChat.firebaseIO-demo.com/users/mike/name/first

If you remove the value for 'first' which you just set, the parents (who now contain no children with data) will be automatically removed and our Firebase will be the same as it was before adding the new user.

Accessing Firebase Data

Easy data accessibility is a core tenet of Firebase. Data at a Firebase location can be accessed in four different ways:

  1. From a Firebase client. Our official client libraries for Web, iOS, Java, and Node will allow you to synchronize Firebase data from within your application.

  2. From our REST API. We provide a full-featured REST API, so that you can read and write your data using any device capable of sending HTTPS requests.

  3. From a library or service with Firebase integration. We provide official integrations for AngularJS, BackboneJS, and EmberJS. We have partnerships to integrate Firebase with various services and we have a lively community who has written Firebase utilies for many languages and frameworks.

  4. From a web browser. You can open any Firebase URL in a web browser to see a live view of its data and the changes that are occurring in real-time. You can create and edit data right from your browser.


Have a suggestion to improve the documentation on this page? Tell us!