A simple, real-time chat application that allows users to create or join temporary rooms for messaging. The rooms expire after all users exit.
- Create new chat rooms with randomly generated IDs
- Join existing rooms using room ID
- Real-time messaging with WebSockets
- Room-based messaging (messages only go to users in the same room)
- Temporary rooms that expire after all users leave
- User join/leave notifications
- Different styling for sent vs received messages
- Connection status indicators
- Frontend: React, TypeScript, Tailwind CSS v4
- Backend: Node.js, TypeScript, WebSockets (ws)
real-time-chat/
├── real-time-chat-fe/ # Frontend React application
├── real-time-chat-be/ # Backend WebSocket server
├── package.json # Root package.json for running both services
└── README.md # This file
- Clone the repository
- Install dependencies for all packages:
npm run install:allTo run both the frontend and backend simultaneously:
npm startOr run them separately:
# Frontend only
npm run start:fe
# Backend only
npm run start:beThe frontend will be available at http://localhost:5173 (or another port if 5173 is in use).
- Open the application in your browser
- Create a new room by clicking "Create New Room" or join an existing room by entering the room ID
- Start chatting!
- When you're done, click "Exit" to leave the room
- The frontend is built with React, TypeScript, and Tailwind CSS v4
- The backend uses a simple WebSocket server with room-based messaging
- Messages are sent to all users in the same room
The application can be deployed as two separate services:
- The frontend can be deployed to any static hosting service (Vercel, Netlify, etc.)
- The backend should be deployed to a service that supports WebSockets (Heroku, Digital Ocean, etc.)
Make sure to update the WebSocket URL in the frontend to point to your deployed backend.