title: Using firebase tree structure to represent a "document outline" structure directly
body: <p>How good/stupid would it be to use Firebase tree structure to <strong>directly</strong> represent a <strong>user-facing</strong> tree structure, like a "document outline" in "word processors"?
  As opposed to e.g. doing an SQL-join parent-child type of relationship and then building the tree via a projection (which would probably be slow).</p>
  
  <p>I know that there is a limit of 32 levels of nesting ( <a href="https://www.firebase.com/docs/web/guide/understanding-data.html" rel="nofollow noreferrer">https://www.firebase.com/docs/web/guide/understanding-data.html</a> ), which should be enough, as I cannot imagine a sane user wanting to do as many levels of nesting for a textual tree-outline...
  Although maybe I need to divide 32 by two, because of each node needing to have sub nodes for its children and metadata, right?</p>
  
  <p>I know that once a tree node is accessed via Firebase API, then all sub-nodes need to be fetched, which could be a performance problem if the user has a lot of data, but in the end I think this would not be a problem, since the data would mostly be a user-entered plaintext (short).</p>
  
  <p>A performance problem could arise if the user pastes some very long chunks of text copied from somewhere (e.g. tens of kilobytes). But then I could separate those "TLOB-s" via a kind of "symlink" in firebase and fetch them on-demand from a different node, right? Same should apply for separating images and other heavy objects, right?
  Although in a prototype and early stages, this should probably be ignored, for the sake of simplicity...
  I could probably put in place a generic approach to "symlinking", to overcome the 32 levels limitation and the need to fetch all sub-nodes at once, right? Is there some best-practices approach for that (e.g. syntax for a firebase node which would symbolise a link to another node) ?
  I have extracted the "symlinking" idea to a separate question: <a href="https://stackoverflow.com/questions/39112871/firebase-symlink-to-another-node">Firebase &quot;symlink&quot; to another node</a> .</p>
  
  <p>I could probably partition the topmost nodes into some kinds of projects/categories to prevent having to fetch absolutely everything the user has ever had...</p>
  
  <p><strong>Is my reasoning/approach correct?</strong></p>
  
  <p><strong>Is there any consideration that I did not think of, e.g. innate limits on data size or performance or e.g. <em>security rules</em>?</strong></p>
  
  <p>Would I be better served by other technologies like Couchbase/Pouchbase ?</p>
  
  <p><strong>Further details:</strong> this is for a hybrid mobile app with some emphasis also on web access and offline access. I hope to do most of the logic in Javascript. The UI part of the question is here: <a href="https://stackoverflow.com/questions/39108063/html-tree-for-hybrid-mobile-app">HTML tree for hybrid mobile app</a> .</p>