This is a basic Web based Group Chat App, Created with Express and Firebase firestore.
- You can access the project online at Group Chat Firbase.
- Node.js and npm installed on your machine.
- A Firebase Project.
-
Clone this repository:
git clone https://github.com/dhextras/group-chat-firebase.git && cd group-chat-firebase/
-
Install dependencies:
npm install
-
Create a Firebase Project and Web App:
-
Follow the official Firebase documentation to create a Firebase project and set up a web app. Firebase Web Setup Documentation
-
After completing this setup, you will obtain a Firebase configuration object.
-
-
Update Configuration and Port:
- Update the
config.json
file in this project with your Firebase configuration details and the desired port number. Make sure to use double quotes (""
) for the keys inside thefirebaseConfig
object.
// Incorrect format (without double quotes for keys):
{
"firebaseConfig": {
apiKey: "YOUR_API_KEY",
// rest of the config...
},
"port": 3000
}
// Correct format (with double quotes for keys):
{
"firebaseConfig": {
"apiKey": "YOUR_API_KEY",
// rest of the config...
},
"port": 3000
}
- Rename
config_test.json
toconfig.json
, You are good to go.
Start the server using:
npm start
- Hooray!! Access the server at
http://localhost:3000
.
Feel free to contribute to this project by opening issues or pull requests.
-
Home Route
- Route:
/
- Method:
GET
- Description: Home route for the application.
- Route:
-
Get Chat Messages
- Route:
/getChatMessages/:chatRoomId
- Method:
GET
- Description: Retrieves messages associated with the specified chat room ID from Firestore.
- Parameters:
chatRoomId
(path parameter): Unique identifier of the chat room.
- Route:
-
Send Messages
- Route:
/sendMessages
- Method:
POST
- Description: Stores a message in Firestore within the specified chat room for a particular user.
- Request Body:
chatRoomId
: Unique identifier of the chat room where the message will be stored.userName
: Name of the user sending the message.message
: Content of the message to be sent.
- Route:
// Example request body for sending a message
{
"chatRoomId": "ABC123",
"userName": "Dhextras",
"message": "Hello, how are you?"
}
This project is licensed under the MIT License.
Ensure that you do not expose your actual Firebase configuration or any sensitive information publicly. The Firebase configuration should be kept secure and not shared publicly.