- live link : live link
- demo video : demo video
TalkSpace is a real-time chat application built using React, Firebase, and Material-UI. This project allows users to sign in with their Google account, create new chats, and send messages to each other.
- User authentication with Google Sign-In
- Real-time chat functionality using Firebase Firestore
- Ability to create new chats and send messages
- Display of chat history and last seen timestamp
- Integration with Material-UI for a responsive and visually appealing interface
- React: A JavaScript library for building user interfaces
- Firebase: A cloud-hosted platform for building web and mobile applications
- Material-UI: A popular React UI framework for building responsive and visually appealing interfaces
- Firestore: A NoSQL document database provided by Firebase
The project is divided into several components:
src: The main directory for the project's source codecomponents: A directory for reusable React componentsutils: A directory for utility functions and helpersfirebase: A directory for Firebase-related configuration and initializationpublic: A directory for static assets and the application's entry point
- App.js: The main application component that renders the chat interface
- Chat.js: A component that renders a single chat conversation
- Sidebar.js: A component that renders the sidebar with a list of chats
- SidebarChat.js: A component that renders a single chat item in the sidebar
- Login.js: A component that handles user authentication with Google Sign-In
saveUserToFirestore: Saves the user's data to Firestore after authenticationcreateNewChat: Creates a new chat document in FirestoresendMessage: Sends a new message to a chat conversationgetLastSeenTimestamp: Retrieves the last seen timestamp for a chat conversation
To set up and deploy the project, follow these steps:
- Clone the repository using
git clone - Install the required dependencies using
npm install - Create a new Firebase project and enable the Firestore database
- Update the
firebaseConfigobject insrc/firebase.jswith your project's configuration - Run the application using
npm start - Deploy the application to a hosting platform of your choice (e.g., Firebase Hosting, Vercel, etc.)
- Make sure to install the Firebase CLI using
npm install -g firebase-tools - Initialize the Firebase project using
firebase init - Set up the Firebase environment variables in a
.envfile:
FIREBASE_API_KEY=YOUR_API_KEY
FIREBASE_AUTH_DOMAIN=YOUR_AUTH_DOMAIN
FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
FIREBASE_STORAGE_BUCKET=YOUR_STORAGE_BUCKET
FIREBASE_MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID
FIREBASE_APP_ID=YOUR_APP_ID- Update the
firebaseConfigobject insrc/firebase.jswith the values from the.envfile:
const firebaseConfig = {
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.FIREBASE_AUTH_DOMAIN,
projectId: process.env.FIREBASE_PROJECT_ID,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
appId: process.env.FIREBASE_APP_ID,
};- Note: Make sure to commit the
.envfile to your repository, but do not push it to a public repository for security reasons.