# Firebase Setup

### All the data is stored in Firebase  Realtime Database and Firestore database.

In Firebase we store the information about the app, like colors, navigation etc..

And in Firestore is where our actual data is. Like menu content, categories, orders etc..

Let's get started. Create an account in Firebase with your google account.

#### Follow all the guides in the tabs.&#x20;

{% tabs %}
{% tab title="Create Project" %}
[Open Firebase](https://firebase.google.com) and Click on "Add Project".&#x20;

Accept terms, and create the project.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqbR4HGZLz4_1tIUDI%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=ac3e07d4-1f55-4aa4-8731-0fb015ce936e)
{% endtab %}

{% tab title="Create Realtime DB" %}
Go to Database and then click on the button called "Create database".

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqbcpG4jJFPD7Rt2o_%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=adc4e198-f3e1-48b0-b47f-780b931d0683)

After clicking on the button it should appear a window that will ask you about security rules. Click on the Start in **test mode** and after that click **Enable.**

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-Lzqbk6X78vzzwb5Y94Q%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=38f753f5-b1f1-4cfc-93fc-aab57f5196ec)

But for production, this is a good starting point. This will allow edit and write to all registered users.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqbrD4dalTePXKzL-z%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=de6edf5d-ffbd-4e82-86eb-096776ef512d)

```
{  
  "rules": {  
    ".read": true,  
     ".write": "auth !== null"  
  }  
} 
```
{% endtab %}

{% tab title="Insert Data" %}
In your realtime database, click on the three dots on right, and select Import JSON.\
In the project you downloaded from CodeCanyon there is a folder **SetupData** there is one .json file. Select that file and import it to your database.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-M1YofE9am-gw-FHZC09%2F-M1YpMD1Bha_0_NlkEAf%2Fimport_json.png?alt=media\&token=b7f3d60d-d635-4ae4-b0f9-c00157d6da31)
{% endtab %}

{% tab title="Create Firestore DB" %}
Go in Databases ->Cloud Firestore

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-Lzqc7BiEZYWzqiYCiev%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=cee5a707-c6f2-4523-a84f-16406c988583)

or

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqcHSW_sE8Ok3TOlo9%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=d0bc1e85-e79b-45ef-bba4-8cd0f26a3a9b)

Then, a pop up will appear.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqcOlzjtKvmfV4RFGP%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=3a75eee2-7786-4d45-8e53-2b48a17e3e84)

For now, use Start in test mode.
{% endtab %}

{% tab title="Create Firestorage" %}
Firebase Storage by default is not initialized. You will need to click on "Storage" and active the Firestorage Bucket.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqcggLuKxQwK0QRFrL%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=45aaad23-a37c-4e7f-a7e8-fe51cccdfe7f)

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqcjsWskLziYL4yKKz%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=dacc382e-6a61-4945-bf69-637f20db52f1)
{% endtab %}

{% tab title="Authentication" %}
Go into Firebase console and click on **Authentication** and after that click on **Set up sign-in method.**

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-Lzqd1ozRjefByGgySnC%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=b0b91b95-08aa-496e-aeb7-ba3a3f438cf6)

Click on **Email/Password** and enable them and click Save.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-Lzqd9qRdksMGqw7r74g%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=1fb4dbef-dc35-4493-b581-ee2da134a90f)

Now click on **Users** and now you should be able to click on **Add user**.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqdK7m1sogIyCtbfbc%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=c22d6f03-bdb9-4fe9-a535-ab263579abd9)

Enter your email and password click Add user.
{% endtab %}

{% tab title="Google Login" %}
**I**f you want to allow Google authentication, you have to do is to enable the Google Auth Provider as on the image below.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqdVFxYqGWHYEtlHgs%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=be19b857-f8ec-4d3f-8a20-403397866882)

Next, scroll below and there you should add your authorized domain. Place where the Google Login will be performed.

![](https://1772895165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lz_IUbVGMg9DXsg2SnG%2F-LzqXjYRZujdyzB35dGm%2F-LzqdaNhmsE9QKYZudKx%2FOrQMiE1lc2WWzKqkwPmAIJ8a5UZ1lEWSICncvyRu.png?alt=media\&token=94c2f20f-921d-444a-a2b8-c8d4385815aa)
{% endtab %}
{% endtabs %}





