A real-time chat application built with WebSocket protocol, featuring user presence, message history, and desktop notifications.
- Node.js with Express.js
- WebSocket (ws) for real-time communication
- SQLite3 for message persistence
- CORS for handling cross-origin requests
- React 19 with TypeScript
- Vite.js for development and building
- TailwindCSS for styling
- Browser Notifications API
- Real-time messaging
- Message persistence
- User presence detection
- Desktop notifications for new messages
- Message history on connection
- Auto-scroll to latest messages
- Clone the repository:
git clone https://github.com/dab/ws-chat.git
cd ws-chat
- Install dependencies for both backend and frontend:
# Install backend dependencies
npm install
# Install frontend dependencies
cd client
npm install
- Start the development servers:
# Terminal 1 - Start backend server
cd server
npm run dev # Runs on http://localhost:3000
# Terminal 2 - Start frontend development server
cd client
npm run dev # Runs on http://localhost:5173
-
Connection Management
- Implement automatic reconnection on connection loss
- Add message delivery confirmation
- Create offline message queue
-
User Management
- Implement user authentication
- Add duplicate username prevention
- Enable user typing indicators
- Add user status features (away, busy, etc.)
-
Message Handling
- Add message editing and deletion
- Implement file attachments support
- Enable message formatting (markdown, etc.)
- Add message delivery status
- Implement read receipts
-
Performance
- Implement message pagination
- Add message lazy loading
-
Security
- Implement input sanitization
- Add rate limiting
- Enable message encryption
- Implement XSS protection