title: Firestore - how to structure a feed and follow system
body: <p>I was using Firebase realtime database for my test social network app in which you can just follow and receive post of people you follow. A traditional social network.
  I structured my database something like this- </p>
  
  <pre><code>Users
  --USER_ID_1
  ----name
  ----email
  --USER_ID_2
  ----name
  ----email
  
  Posts
  --POST_ID_1
  ----image
  ----userid
  ----date
  --POST_ID_2
  ----image
  ----userid
  ----date
  
  Timeline
  --User_ID_1
  ----POST_ID_2
  ------date
  ----POST_ID_1
  ------date
  </code></pre>
  
  <p>I also have another node "Content" which just contained id of the all the user post. So, if "A" followed "B" than all the post id of B where added to A's Timeline. And if B posted something than it was also added to all of its follower's timeline.</p>
  
  <p>Now this was my solution for realtime database but it clearly have some scalability issues </p>
  
  <ul>
  <li>if someone have 10,000 followers than a new post was added to all of the 10,000 follower's Timeline. </li>
  <li>If someone have large amount of posts than every new follower received all of those posts in his Timeline.</li>
  </ul>
  
  <p>These were some of the problems.</p>
  
  <p>Now, I am thinking to shift this whole thing on firestore as its been claimed "Scalable". So how should I structure my database so that problems I faced in realtime database can be eliminated in firestore.</p>