A fully-functional real-time chat application that allows users to send and receive messages instantly. This app is built using modern web technologies with real-time updates powered by Pusher.
- Real-Time Messaging: Instantly send and receive messages without refreshing the page.
- Message Broadcasting: Messages are broadcast to all users in real-time.
- Message Deletion: Users can delete messages they sent, and the deletion is broadcast to other users.
- Chat History: Load previous chat messages when joining the chat room.
- Username Persistence: Usernames are stored locally, so users can continue chatting after refreshing the page without re-entering their username.
- Responsive UI: The app is mobile-friendly and responsive on all devices.
- Frontend: React, Tailwind CSS
- Backend: Node.js, Express
- Database: MongoDB
- Real-Time Communication: Pusher
- Build Tool: Webpack, React Scripts
- Hosting: Vercel
-
Clone this repository.
git clone https://github.com/agussuwerdo/realtime-chat-app.git cd realtime-chat-app
-
Install dependencies for both server and client.
make install
-
Set up environment variables in the root and client
.env
file:PUSHER_APP_ID=your-pusher-app-id PUSHER_KEY=your-pusher-key PUSHER_SECRET=your-pusher-secret PUSHER_CLUSTER=your-pusher-cluster MONGODB_URI=your-mongodb-connection-string
REACT_APP_PUSHER_KEY= REACT_APP_PUSHER_CLUSTER=
-
Build the React client:
make build
-
Start the server:
make dev
-
Visit
http://localhost:3000
in your browser to start chatting!
Check out the live demo: https://realtime-chat-green-five.vercel.app/
-
Connection Security:
- The connection between the server and the client is not secured (no HTTPS or TLS).
- Use secure WebSocket communication and enforce HTTPS on the server.
-
Authentication:
- Currently, there is no token-based authentication.
- Implement authentication to protect chat rooms, such as using JWT (JSON Web Token).
-
User Validation:
- There is no user validation for sending or receiving messages.
- Add user authentication and validation to ensure only authorized users can send and delete messages.
-
Encryption:
- Messages are not encrypted during transmission.
- Consider encrypting sensitive data to enhance security.
-
Rate Limiting:
- No rate-limiting is implemented, which could expose the app to denial of service (DoS) attacks.
- Implement rate-limiting on the server to prevent abuse.
-
File Uploads:
- The app currently does not support sending images or file attachments.
- Add support for file and image uploads with proper validation.
This project is licensed under the MIT License.