An open API service indexing awesome lists of open source software.

https://github.com/inaveed-git/websocket-chatapp

A lightweight real-time chat application built with React, TypeScript, and WebSockets. Users can join a room using a unique Room ID and exchange messages instantly with others in the same room.
https://github.com/inaveed-git/websocket-chatapp

chat tailwind websocket

Last synced: about 2 months ago
JSON representation

A lightweight real-time chat application built with React, TypeScript, and WebSockets. Users can join a room using a unique Room ID and exchange messages instantly with others in the same room.

Awesome Lists containing this project

README

          

## ๐Ÿ’ฌ WebSocket Chat Room

A lightweight real-time chat application built with **React**, **TypeScript**, and **WebSockets**. Users can join a room using a unique `Room ID` and exchange messages instantly with others in the same room.

---

### ๐Ÿš€ Features

* ๐Ÿ“ก Real-time messaging with WebSocket
* ๐Ÿง  Room-based chat functionality
* ๐Ÿ—ƒ๏ธ Room ID stored in localStorage (auto-join after refresh)
* ๐Ÿ’ก Lightweight frontend with Tailwind CSS
* ๐Ÿ“ฆ Built using TypeScript (frontend + backend)
* โœ… Responsive UI

---

### ๐Ÿ“ Project Structure

```
.
โ”œโ”€โ”€ backend
โ”‚ โ””โ”€โ”€ src
โ”‚ โ””โ”€โ”€ index.ts # WebSocket server using ws
โ”œโ”€โ”€ frontend
โ”‚ โ””โ”€โ”€ src
โ”‚ โ””โ”€โ”€ App.tsx # React chat app
โ”‚ โ””โ”€โ”€ main.tsx
โ”‚ โ””โ”€โ”€ index.css
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ package.json
```

---

### ๐Ÿ› ๏ธ Tech Stack

* **Frontend**: React + TypeScript + Tailwind CSS
* **Backend**: Node.js + TypeScript + ws (`WebSocket` library)

---

### โš™๏ธ Getting Started

#### 1. Clone the repository

```bash
git clone https://github.com/inaveed-git/WebSocket-ChatApp.git
cd WebSocket-ChatApp
```

---

#### 2. Setup Backend

```bash
cd backend
npm install
npm run dev
```

> This will start the WebSocket server on `ws://localhost:8080`.

---

#### 3. Setup Frontend

```bash
cd frontend
npm install
npm run dev
```

> This will start the React app on `http://localhost:5173` (Vite default port).

---

### ๐Ÿ“ท Preview

![Chat UI Preview](frontend/screenshots/ws1.PNG)
![Chat UI Preview](frontend/screenshots/ws2.PNG)

---

### ๐Ÿงช Usage

1. Start both the **frontend** and **backend**.
2. Open the app in the browser.
3. Enter a `Room ID` to join a chat room.
4. Start chatting with others who join the same room!

---

### ๐Ÿ“Œ Notes

* The app uses a single WebSocket connection.
* Messages are **not persisted** โ€” no database.
* Designed for local use or learning purposes.

---

### ๐Ÿง‘โ€๐Ÿ’ป Author

**Naveed khan**
GitHub: [@inaveed-git](https://github.com/inaveed-git)

## License

This project is licensed under the [MIT License](./LICENSE).