1. Home
  2. Docs
  3. TikTok App Template
  4. Backend Setup
  5. Firebase Setup

Firebase Setup

1. Linking Your Own Firebase Account

To set up your own backend, you need to first link your own Firebase account to the React Native source code. This is pretty straightforward and common to all React Native apps that use Firebase as backend, but if you haven’t done this already, please follow our step-by-step Firebase Setup guide.

2. Creating The Firestore Tables

All Firestore database tables are created automatically for you, as you start using the app. To populate all the tables, you first do the following, directly in the app:

  1. Register two new users with e-mail and password (feel free to upload profile pictures, to test that Firebase Storage was properly set up)
  2. Have those users follow each other (you can use the Search screen to find them)
  3. Create a new TikTok (no need for a background song, we’ll set that up that later) – Make sure you also use a hashtag
  4. Like and comment on that TikTok post
  5. Add a few chat messages between these 2 users

Initially, the first post won’t show up in the other user’s feed. That’s because you need to create the required Firestore indexes on all the needed tables. In the console, please watch out for any warnings / errors that look like this:

10. Error: Firestore: Operation was rejected because the system is not in a state required for the operation`s execution. (firestore/failed-precondition)”

or like this

The query requires an index. You can create it here:

This error shows up when first running our apps that have more complex performance improvements.

You need to create the proper indices in your Firestore tables, used for loading data much faster. We do console.log these errors, so simply look into the console for a custom Firebase URL that looks like this (“The query requires an index. You can create it here: “):

 

After following all these steps, refresh your Firebase Console, go to the Firestore tab, and you’ll see the following tables:

users

SocialNetwork_Posts

socialnetwork_comments

socialnetwork_reactions

social_feeds

entities