Skip to content

Firebase Database Structure

Wynston Ramsay edited this page Apr 1, 2018 · 5 revisions

Firebase Database Structure

Major Access Points:

  1. /users
  2. /worlds
  3. /collaborations

These three access points provide the necessary data storage needed for a real-time collaborative VR data visualization application

  • Users have a reference to all of their own worlds as well as any world they collaborate on.
  • Worlds keeps track of it's owner and collaborators as well as all necessary data for maintaining a VR world.
  • Collaborations stores all the instances of a collaboration which includes a VR world, the owner of the world, and any collaborators that will also have access.
  • We made sure to use a flattened model to increase access speeds for the sake of real-time, at the cost of having to update multiple fields in certain scenarios
    • For example: A user deletes one of their worlds, not only does the owner's data need to be updated but also the collaborator's as well as the list of all worlds.

Sample Database Model:

{
  "users": {
    "user_id": {
      "email": "",
      "name": {
        "given_name": "",
        "family_name": ""
      },
      "profile_picture": "",
      "worlds": {
        "world1_id": true,
        "world2_id": true,
        "world3_id": true
      },
      "collaborations": {
        "collaboration1_id": true,
        "collaboration2_id": true
      }
    }
  },
  "worlds": {
    "world_id": {
      "owner": {
        "user_id": true
      },
      "collaboration": {
        collaboration1_id: true
      },
      "geometries": {},
      "materials": {},
      "metadata": {},
      "object": {}
    }
  },
  "collaborations": {
    "collaboration_id": {
      "owner": {
        "user_id": true
      },
      "world": {
        "world_id": true
      },
      "collaborators": {
        "user1_id": true,
        "user2_id": true,
        "user3_id": true,
        "user4_id": true
      }
    }
  }
}

Clone this wiki locally