This project is a simple chat room application built using React and Firebase. It allows users to sign in with Google, send messages in real-time, and view messages from other users. The application leverages Firebase Authentication, Firestore, and Firebase Analytics.
- Features
- Technologies Used
- Screenshots
- Setup and Installation
- How to Use
- Deployment
- Project Structure
- Future Improvements
- License
- Google Authentication: Users can sign in using their Google accounts.
- Real-Time Messaging: Messages are updated in real-time using Firestore.
- User-Friendly Interface: The UI is simple, clean, and easy to use.
- Community Guidelines: Clear guidelines are provided to ensure a safe and respectful environment.
- Responsive Design: The application is designed to work well on various screen sizes.
- React: Front-end JavaScript library for building user interfaces.
- Firebase Authentication: Manages user authentication via Google.
- Firestore: Cloud-hosted NoSQL database that stores chat messages.
- Firebase Analytics: Collects usage data to help improve the app.
- CSS: Custom styles for the application.
To set up and run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/rishi-vakharia/react-firebase-chat-room.git cd react-firebase-chat-room
-
Install dependencies: Make sure you have Node.js installed. Then run:
npm install
-
Firebase Setup:
- Create a Firebase project at Firebase Console.
- Enable Google Authentication in the Firebase Authentication settings.
- Set up Firestore in your Firebase project.
- Create a
.env
file in the root of your project and add your Firebase configuration:REACT_APP_API_KEY=your-api-key REACT_APP_AUTH_DOMAIN=your-auth-domain REACT_APP_PROJECT_ID=your-project-id REACT_APP_STORAGE_BUCKET=your-storage-bucket REACT_APP_MESSAGING_SENDER_ID=your-messaging-sender-id REACT_APP_APP_ID=your-app-id REACT_APP_MEASUREMENT_ID=your-measurement-id
-
Start the development server:
npm start
The app will be available at
http://localhost:3000
.
-
Sign In:
- Click on "Sign in with Google" to authenticate yourself.
-
Chat:
- Type a message in the input box and press Enter or click the send button (🕊️) to send it.
- View your message and other users' messages in real-time.
-
Sign Out:
- Click on the "Sign Out" button in the header to log out.
You can deploy the site using the build
folder and the serve
command.
-
Build the project:
npm run build
This will create a
build
folder with a production-ready version of your app. -
Serve the app locally: Install
serve
globally if you haven't already:npm install -g serve
Then, serve the
build
folder:serve -s build
Your app will be available at
http://localhost:5000
. -
Deploy to a hosting service:
- You can deploy the contents of the
build
folder to any static site hosting service, such as GitHub Pages, Vercel, or Netlify.
- You can deploy the contents of the
/src
|-- App.css # CSS file for styling the application
|-- index.js # Entry point for React
|-- App.js # Main application component
|-- ChatRoom.js # Chat room component handling messages
|-- ChatMessage.js # Chat message component for displaying individual messages
|-- SignIn.js # Sign-in component for Google authentication
|-- SignOut.js # Sign-out component for logging out
- Add Private Messaging: Implement private chat rooms or direct messaging between users.
- Enhanced User Profiles: Allow users to set display names or profile pictures.
- Message Reactions: Enable users to react to messages with emojis.
- Moderation Tools: Implement moderation features to enforce community guidelines.