ReactRealtime is a real-time chat application that allows users to join rooms by providing their username and room name. The project leverages modern web technologies to deliver a smooth and responsive chat experience.
- Real-time messaging
- Room-based chat
- User-friendly interface
- Framework: Vite (React + TypeScript)
- Styling: Tailwind CSS
- Server: Node.js
- Framework: Express
- Real-time Communication: Socket.IO
- Cross-Origin Resource Sharing: CORS
In the server folder, there is a .env file where you can set the following variables:
-
PORT: The port on which the server will run (default is3001). -
CORS_ORIGIN: The origin allowed by CORS (default ishttp://localhost:5173).
In the client folder, there is a .env.local file where you can set the following variables:
PORT: The port where the server is running (default is3001).VITE_SERVER_URL: The URL of the server if it is deployed somewhere other than the local machine (default ishttp://localhost:3001).
-
Clone the repository
git clone https://github.com/kelvinleandro/react-chat-websocket.git cd react-chat-websocket -
Install dependencies for the frontend
cd client npm install -
Install dependencies for the backend
cd ../server npm install
-
Start the backend server
cd server npm startThe server will start on
http://localhost:3001. -
Start the frontend development server
cd ../client npm run devThe frontend will start on
http://localhost:5173.
- Open your browser and navigate to http://localhost:5173.
- Enter a username and room name to join a chat room.
- Start chatting in real-time!
