How to Build a Chat App With React and Firebase
Ever wondered how WhatsApp works? Or how different users connect and exchange messages in chats? Creating a simplified chat application can be a great way to grasp the core functionalities behind chat applications.
Building a chat app can seem like a daunting task, however, Firebase simplifies the process. It enables you to quickly bootstrap any application, removing the need for a custom backend or a database setup.

What Is Firebase Cloud Database
Firebase is a cloud-based development platform that offers a range of backend services such as a real-time database, authentication, and hosting. At the core of its database services, is a NoSQL cloud database that utilizes a document model to store data in real-time.
Set Up the Firebase Project and the React Client
you’re able to check out the chat application code available on thisGitHub repositoryand it’s free for usage under the MIT License. Make sure you configure Firebase before running the application.
To get started, head over toFirebaseand sign up for an account. On the user dashboard, clickCreate Projectto set up a new project.

After creating your project, select and click on the code icon on the project’s overview page to register your application. Registering with Firebase allows you to access and utilize its resources to build your React web app.
Take note of the instructions for integrating Firebase’s SDK to your project underAdd Firebase SDK.

Next,create a React applicationand install the Firebase SDK in your application. Additionally, import thereact-firebase-hookspackage that simplifies working with Firebase In React.
Configure Firebase in Your React Application
In yoursrcdirectory, create a new file and name it,firebase-config.js. Copy the environment variables from your firebase project dashboard and paste them into this file.
Using your Firebase project’s configuration, you initialize the Firebase, Firestore, and Firebase’s authentication functions for usage within your app.

Set Up a Firestore Database
This database will store user data and chat messages. Head over to your project overview page and click onCreate databasebutton to set up your Cloud Firestore.
Define the database mode and location.

Lastly, update the Firestore database rules to allow read-and-write operations from the React application. Click on theRulestab and change theread-and-writerule totrue.
Once you are done setting up the database, you can create a demo collection — this is a NoSQL database in Firestore. The collections are made up of documents as records.
To create a new collection, click on theStart collectionbutton, and provide a collection ID — a table name.
Integrate Firebase User Authentication
Firebase provides out-of-the-boxauthentication and authorizationsolutions that are easy to implement such as social login providers or the custom email-password provider.
On your project’s overview page, selectAuthenticationfrom the list of products displayed. Next, click on theSetup sign-in methodbutton to configure the Google provider. Select Google from the list of Providers, enable it, and fill in the project support email.
Create a Sign-In Component
Once you are done configuring the provider on Firebase, head over to your project folder and create a new folder,components, in the/srcdirectory. Inside thecomponentsfolder, create a new file:SignIn.js.
In theSignIn.jsfile, add the code below:
Create a Chat Component
This component will house the main feature of your Chat application, the chat window. Create a new file inside thecomponentsfolder, and name itChat.js.
Add the code below in theChat.jsFile:
Create a Send Message Component
Create a new file,SendMessage.jsfile, and add the code below:
Import the Components in the App.js File
Lastly, in yourApp.jsfile, import theSignInandChatcomponents to render them on your browser.
In yourApp.jsfile, delete the boilerplate code, and add the code below:
This code renders theSignInandChatcomponents conditionally by checking the authentication status of a user. The authentication status is destructured from the Firebase authentication component with the help of theuseAuthStatehook from thereact-firebase-hookspackage.
It checks if a user is authenticated, and renders theChatcomponent otherwise theSignIncomponent is rendered. Finally, add in any CSS styles, spin up the development server to save the changes, and head over to your browser to view the final results.
Firebase Serverless Functionalities
Firebase provides a range of features beyond a real-time database and authentication. You can use its serverless functionalities to quickly bootstrap and scale any application. Furthermore, Firebase seamlessly integrates with both web and mobile applications making it easy to build cross-platform applications.
Find out how Firebase can make it easy to onboard users.
These films will leave you questioning humanity, but also wanting more.
So much time invested, and for what?
I found my TV was always listening—so I shut it down.
The fix was buried in one tiny toggle.
These are the best free movies I found on Tubi, but there are heaps more for you to search through.