A modern, real-time chat application built with Node.js, Express, and Socket.IO. Features text messaging, image sharing, file transfers, and real-time user presence.
- Real-time Messaging: Instant text communication with other users
- Media Sharing: Send and receive images directly in chat
- File Transfers: Share files with icon-based visual indicators
- User Presence: See who's online in real-time
- Responsive Design: Works on desktop and mobile devices
- File Security: 10MB file size limit with type validation
- Modern UI: Gradient design with smooth animations
chat-app/
├── server.js # Main server file
└── public/
├── index.html # Frontend interface
└── favicon.ico # Website icon
- Node.js (v14 or higher)
- npm or yarn
-
Clone or download the project files
Create a folder with
server.jsandpublic/directory containingindex.htmlandfavicon.ico -
Install dependencies
Open terminal in project directory and run:
npm init -ynpm install express socket.io -
Start the server
node server.js -
Access the application
- Open browser and navigate to:
http://localhost:33333 - Or use your local IP address shown in console
- Open browser and navigate to:
- Enter a username in the input field
- Press Enter or click outside the field
- Read the chat rules displayed upon joining
- Text: Type in the message box and press Enter/Send
- Images: Click the image button and select an image file
- Files: Click the file button and select any file type
- Images: Click to view in full-screen modal
- Files: Click to see file details and download options
- Right sidebar displays all connected users
- User count updates in real-time
- Port: 33333 (configurable in server.js)
- Host: 0.0.0.0 (accessible from network)
- CORS: Enabled for all origins
- File Limit: 10MB maximum per file
The application displays appropriate icons for different file types:
- 📄 Documents (PDF, TXT, DOC)
- 📊 Spreadsheets (XLS, CSV)
- 🖼️ Images (JPG, PNG, GIF)
- 🎵 Audio (MP3, WAV)
- 🎬 Video (MP4, AVI)
- 📦 Archives (ZIP, RAR)
- ⚙️ Executables (EXE, MSI)
The server automatically detects and displays:
- Localhost URL:
http://localhost:33333 - Local IP URL:
http://[YOUR-IP]:33333 - Network access for other devices on the same network
- Input Validation: Basic client-side file size validation
- Content Sanitization: HTML content handling
- Connection Management: Proper user join/leave tracking
- File Restrictions: 10MB size limit to prevent abuse
Port already in use: Change PORT variable in server.js line 144
Socket connection failed: Ensure firewall allows port 33333
Files not sending: Check file size (must be ≤10MB)
Users not appearing: Refresh browser or check console for errors
For debugging, add this to server.js after line 10:
console.log('Debug: New connection from', socket.handshake.address);
- Chrome 60+ ✓
- Firefox 55+ ✓
- Safari 11+ ✓
- Edge 79+ ✓
- Mobile browsers ✓
To add new file type icons, modify the fileIcons object in server.js (lines 22-30):
const fileIcons = { // Add new mappings here 'py': '🐍', // Python files 'js': '📜', // JavaScript files 'html': '🌐', // HTML files // ... existing mappings };
Change the PORT constant in server.js line 144:
const PORT = 33333; // Change to desired port
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Express.js
- Real-time functionality powered by Socket.IO
- Icons from Unicode emoji set
- Gradient designs inspired by modern web trends
- This is a demonstration application - not suitable for production without additional security measures
- All files are transferred as Base64 - consider chunking for large files
- No persistent storage - messages are lost on server restart
- No authentication - anyone can join with any username
- Monitor server resources when sharing large files
Enjoy chatting! For questions or issues, please check the console for error messages and ensure all dependencies are properly installed.