A modern, real-time chat application built with Node.js, Express, and Socket.io. Users can create rooms, chat in real-time, and see typing indicators.
- ✨ Real-time messaging with WebSocket
- 👥 Multiple chat rooms
- 📝 Live typing indicators
- 👤 User presence tracking
- 📱 Responsive design
- 🎨 Modern UI with gradient design
- 🔒 XSS protection
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/Obaego12-debug/Text-.git
cd Text-- Install dependencies:
npm install- Create a
.envfile:
cp .env.example .env- Configure
.envif needed (default settings work for local development)
Development mode (with auto-reload):
npm run devProduction mode:
npm startThe app will start on http://localhost:3000 by default.
- Open
http://localhost:3000in your browser - Enter a username
- Enter a room ID (e.g., "general", "tech", "random")
- Click "Join Room"
- Open another browser tab/window and repeat steps 2-4 with the same room ID
- Start chatting!
src/
├── server.js Main application with Socket.io setup
public/
├── index.html Chat UI
├── styles.css CSS styling
├── chat.js Client-side Socket.io logic
.env.example Environment variables template
.gitignore Git ignore rules
.eslintrc.json ESLint configuration
package.json Project configuration
README.md This file
GET /api/health— Server health checkGET /api/rooms— List all active chat roomsGET /api/users— List all connected users
Client → Server:
join_room— Join a chat room with usernamesend_message— Send a message to the roomtyping— Notify that user is typingleave_room— Leave current room
Server → Client:
user_joined— User joined the roomreceive_message— New message receiveduser_typing— User is typing indicatoruser_left— User left the roomuser_disconnected— User disconnected
npm run lintnpm testPORT=3000 # Server port
NODE_ENV=development # Node environment- Express.js — Web framework
- Socket.io — Real-time WebSocket communication
- dotenv — Environment configuration
- nodemon — Development auto-reload
- ESLint — Code linting
- Jest — Testing framework
- User authentication with JWT
- Message persistence (MongoDB/PostgreSQL)
- Private direct messages
- User profiles and avatars
- Message reactions and editing
- File sharing
- Message search
- Voice/video chat
Feel free to submit issues and enhancement requests!
MIT License
For issues and questions, please create an issue on GitHub.