Chat app with Ionic 3 and firebase – Ep. 1 – Sign in & tabs.

Hello Friends,

This is my first post on how to create a chat app using Ionic 3 and Firebase. This is going to be a series of posts covering how to create a complete chat app with real-time chatting and group chat features. You could also send images in your chat leveraging the power of firebase storage that allows you to store and serve images.

To see how this app would look click here.

Enough talk, let’s write some code.

A screencast of this post.


The code for this post is available here.

The complete code for this post is available here (would appreciate it very much if you could add a star to the repo. Thanks)


First let’s scaffold out an Ionic 3 application using the below command.

Install the firebase and angularfire2 libraries using the below command.

Now go ahead and delete the home page found in your src/pages directory. Let’s start from scratch.

Now open up your terminal again and give the below commands to generate two new pages.

Now get into app directory and create a new file called app.firebaseconfig.ts and the below code into it.

Replace the <> values with your actual values from firebase.

Now open up app.module.ts and add imports for firebaseconfig. Also add imports for Angularfire2 and it should look as shown below.

Note the AuthProvider in the providers and tabsPlacement option (which basically places the tabs at the top of the screen).

Generate a provider using the below command.

Now open up login.html and add the below code.

Now open login.scss and add the below code.

Ensure that you are giving a proper URL for the background image and that image is actually present in your assets folder.

If there are no errors, then your login screen would look like as shown below.


Let’s create an interface for our user credentials. Create a new directory inside the src directory and name it as models. Inside it create another directory called interfaces. Now create a file called usercreds.ts and add the below code in it.

Now open up login.ts file and add the below code.

We are simply calling the login() function present in the auth provider and passing on the entered email and password to it.

(We will be seeing about the signup() and passwordreset() functions in the upcoming videos).

Open up auth.ts in your provider directory and add the below code into it.

Okay now that this is done. our login should work fine. Kindly ensure that in the app.component.ts file you are setting the rootPage to our login page as shown below.

Okay now if you login you will see a blank page with just a header saying tabs right. Let’s go ahead and create the pages that we want in these tabs.

Generate three pages with the commands below.

Now that we have the pages, let’s go ahead and include them in our tabs page.

Open up tabs.ts and add the below code.

Now open up tabs.html and add the below code.

Now that the tabs are coded in. Let’s bring that nice teal color into the hcolor variable.

Open up variables.scss inside the theme directory and the hcolor to the $colors variable as shown below.

Now just add this hcolor to each of the navbars in the chats, groups and profile page so that they blend in with the tabs color.

Also to get the titles in the center just open up app.scss inside the app directory and add the below code.

(In iOS the default behaviour would be to display the title in the center).

If everything goes fine, as soon as you login you should see a screen like this.


Note that when you click the tabs the corresponding pages get loaded.


It’s cool right. In our next post let’s see how to create a sign up page that enables the user to sign up and choose a profile picture for his account. We’ll also see how to enable a provision to reset the password for a specific user.

Hope this helped you guys, if you found this helpful kindly consider supporting me by becoming my patron on patreon (Costs a couple of bucks and you get early access to all my videos). Click here.

If you can’t become my patron, that’s fine just share / tweet this post and help someone else out who is looking for quality content.

Thanks for reading guys. Stay tuned for episode 2.

Peace., :)

Liked it? Take a second to support admin on Patreon!
  • Michael John

    perfectly done, expecting next post on this chat app

    • It will be up in 6 hours bro.. Video is rendering now, Once it is done, I will upload it and commit the code to Github.. Thanks.

  • Summiya Iqbal

    File ‘D:/projects/ionic/app/src/models/interfaces/usercreds.ts’ is not a module.
    error while running code can you plz help

  • Nader Bourawi

    i cant see input fields when i click on it !!,?? i tested it android device android version

  • Miguel Vera

    hi raja. I’ve just started your project and I keep geting this erroe when serving the app “app.firebaseconfig” is not a module. can you please provide some advice? thanks in advance!

  • marco pongetti

    I had to install the following code:
    npm install promise-polyfill –save-exact

    • vozax developer

      its also not working

  • marco pongetti


  • marco pongetti

      have you got solution to your problem ??