WS Chat is a simple WebSocket-based chat application that allows users to communicate in real-time. The application is built using TypeScript, Vite, and FlyonUI (TailwindCSS), and it features a user-friendly interface with support for multiple users.
- Real-time messaging using WebSockets
- User-friendly interface with TailwindCSS
- Display of online users
- Informational messages for user join and leave events
- Modular code structure for easy maintenance
Before you begin, ensure you have met the following requirements:
Node.js(version 18 or higher)npmorpnpm(for package management)
-
Clone the repository:
git clone https://github.com/smkthat/ws-chat.git cd ws-chat -
Install the dependencies:
pnpm install
To start the development server, run:
pnpm devThis will start the Vite development server and open the application in your default web browser.
To start the WebSocket server, run:
pnpm wsThis will start the WebSocket server on ws://localhost:8080.
Setup project and run development using Makefile
makeTo build the project for production, run:
pnpm buildThis will compile the TypeScript code and bundle the application using Vite.
To preview the production build, run:
pnpm previewThis will start a local server to preview the built application.
src/: Contains the source code for the applicationchat.ts: Main chat functionalitymain.ts: Entry point for the applicationassets/styles/: Contains the CSS styles
server.js: WebSocket server implementationindex.html: Main HTML filetailwind.config.js: TailwindCSS configurationvite.config.ts: Vite configuration
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more information.
Feel free to customize this README.md to better fit your project's specifics and add any additional information that might be relevant to users or contributors.