A modern, real-time messaging application for local area networks with text chat, voice messages, file sharing, and more!
| Feature | Status |
|---|---|
| π¬ Text Messaging | β |
| π Private 1:1 Chat | β |
| π’ Channels with Password | β |
| π€ Voice Messages | β (HTTPS) |
| π File Upload (100MB) | β |
| πΌοΈ Image/Video Preview | β |
| π₯ Real-time User List | β |
| π± Mobile Responsive UI | β |
| π Dark Theme | β |
| πΎ Message History | β |
| π HTTPS Support | β |
npm installnpm install express socket.io express-fileuploadGenerate self-signed certificate:
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365During certificate generation, press Enter for all questions or fill in:
- Country Name:
US - State:
California(or leave blank) - City:
San Francisco(or leave blank) - Organization:
My Organization(or leave blank) - Common Name:
localhostβ οΈ IMPORTANT - Email: (leave blank)
my-lan-chat/
βββ server.js # Backend server
βββ index.html # Frontend client
βββ package.json # Dependencies
βββ key.pem # SSL key (generated)
βββ cert.pem # SSL certificate (generated)
βββ public/
βββ uploads/ # File uploads (auto-created)
node server.jsIf key.pem and cert.pem exist, the server automatically runs in HTTPS mode with all features enabled.
If SSL certificates don't exist, HTTP mode runs automatically:
- β Text messaging
- β Private chat
- β Channels
- β File upload
- β Voice messages (requires HTTPS)
After starting the server, you'll see:
============================================================
π LAN MESSENGER SERVER STARTED
============================================================
π‘ Protocol: HTTPS
π Port: 3000
============================================================
π ACCESS FROM:
π± This device: https://localhost:3000
π Network (Wi-Fi): https://192.168.1.100:3000
π Network (Ethernet): https://192.168.0.50:3000
============================================================
β
HTTPS ENABLED - All features available!
============================================================
- Same Computer:
https://localhost:3000 - Other Devices on LAN: Use the network IP shown (e.g.,
https://192.168.1.100:3000) - Mobile Devices: Same network IP with HTTPS
When visiting HTTPS URL for the first time, your browser shows a security warning. This is normal and safe for self-signed certificates!
How to proceed:
- Chrome: Click "Advanced" β "Proceed to localhost (unsafe)"
- Firefox: Click "Advanced" β "Accept the Risk and Continue"
- Safari: Click "Show Details" β "Visit This Website"
- Edge: Click "Advanced" β "Continue to [URL]"
- Mobile: Tap "Advanced" β "Proceed"
- Login as two different users
- Type a message in General channel
- Message appears instantly on all clients
- Login as "Alice" and "Bob" on different devices
- Alice clicks "Bob" in ONLINE USERS section
- Type a private message
- Only Bob sees the message
- Bob can reply and chat with Alice
- Click
+next to CHANNELS - Enter channel name (e.g., "marketing")
- Enter optional password
- Channel appears for all users immediately
- Users need password to join
- Must be on HTTPS (not HTTP)
- Open any chat
- Press and HOLD the microphone button π€
- Speak your message (minimum 500ms)
- Release to upload
- Voice message appears as audio player
- Others can play and hear your message
- Click attachment icon π
- Select file (image, video, audio, document)
- Maximum 100MB
- File uploads and appears as:
- Image: Preview thumbnail
- Video: Playable video
- Audio: Audio player
- Other: Download link
- User A joins chat
- User B immediately sees User A in ONLINE USERS
- User A goes offline
- User A immediately disappears from list
- Notification message appears in General channel
β Fully Responsive Design
- Touch-friendly buttons (34-36px)
- Optimized layout for all screen sizes
- Proper text sizing
- Works on phone and tablet
β Mobile-Specific Features
- Hamburger menu for sidebar
- Auto-close sidebar on selection
- Proper keyboard handling
- Voice recording on mobile
- File upload on mobile
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser (Client) β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β HTML/CSS/JavaScript UI β β
β β - Real-time message display β β
β β - Voice recording β β
β β - File upload handler β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β Socket.IO
β (WebSocket)
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββ
β Node.js Server (server.js) β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β Express + Socket.IO β β
β β - User authentication β β
β β - Channel management β β
β β - Message routing β β
β β - File storage β β
β β - Real-time updates β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
User Action β Client β Socket.IO β Server β Process β Broadcast β All Clients
Solution: Clear browser localStorage
// In browser console (F12)
localStorage.clear()Then refresh and login with new username.
Check Server Logs: Should show:
π¬ Private Room ID: Alice___PRIVATE___Bob
β
Message sent to room: Alice___PRIVATE___Bob
If missing, reconnect and try again.
Causes & Solutions:
- β Using HTTP β Switch to HTTPS
- β Holding button <500ms β Hold for at least 1 second
- β Microphone blocked β Allow microphone in browser
- β No HTTPS certificate β Generate certificate (see above)
To Enable HTTPS:
- Generate certificates:
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365 - Restart server:
node server.js - Access via
https://
Check:
- β Both devices on same network (Wi-Fi/Ethernet)
- β
Server running:
node server.js - β Firewall allows port 3000
- β Using correct IP from server output
- β Using HTTPS and accepted certificate
- β No proxy or VPN blocking connection
Check Server Console: Should show:
β
Channel created successfully
All connected clients should receive updated channel list. Try refreshing page if needed.
Causes:
- File larger than 100MB
- Server
/public/uploadsfolder not writable - Disk full
Solution: Check server console for error details.
This is normal! Self-signed certificate always shows this warning on first visit.
Solution: Click "Advanced" and proceed. It's safe for your LAN.
The server shows detailed real-time logs:
β
New connection: socket123 # Client connected
π€ Join request from: Alice # User joining
β
Alice registered and joined General # Join successful
π¬ Message from Alice: # Message event
Room: Bob
Private: true
Type: text
β
Message sent
π File uploaded: voice_123.webm # Voice message
β Alice disconnected # User left
- β Self-signed HTTPS certificates (secure for LAN)
- β Password-protected channels
- β Private 1:1 messaging
- β No authentication database (usernames only)
- β Messages stored in memory (cleared on restart)
- β File upload limited to 100MB
β οΈ Not intended for internet/public use
Client β Server:
socket.emit("join", username)
socket.emit("sendMessage", { room, isPrivate, type, content })
socket.emit("joinChannel", { name, password })
socket.emit("createChannel", { name, password })
socket.emit("joinPrivate", otherUsername)Server β Client:
socket.on("joinSuccess")
socket.on("receiveMessage", message)
socket.on("updateUserList", users)
socket.on("channelList", channels)
socket.on("joinFail", errorMessage)# Install everything
npm install express socket.io express-fileupload
# Generate SSL certificates
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365
# Start server
node server.js
# Clear browser data (in console)
localStorage.clear()- express - Web server framework
- socket.io - Real-time communication
- express-fileupload - File handling
- Node.js - Runtime environment
- Use HTTPS for best experience - All features work
- Create channels for team discussions - Organize conversations
- Password protect sensitive channels - Add security
- Voice messages save bandwidth - Better than text for complex topics
- File sharing works great - Share documents, images, videos
- Message history saves - Scroll up to see previous messages
- User list updates in real-time - See who's online instantly
- β Windows 10/11 with Chrome, Firefox, Edge
- β macOS with Safari, Chrome
- β Ubuntu Linux with Chrome, Firefox
- β iOS Safari (mobile)
- β Android Chrome (mobile)
Open source - Use freely for your LAN
Add cloudflared for https and handle to https request making it access from everypart of world and different network. Server run in local machine and handle history text and uploaded file. Domain name = chat.lanchat.me This only works when server was running in local machine or host server. Cloudflared RAY id= 9b3adfd63e50ede5 common error or show this type of text when you try to access this domain and server was closed
What happened?
You've requested a page on a website (chat.lanchat.me) that is on the Cloudflare network. The host (chat.lanchat.me) is configured as an Cloudflare Tunnel, and Cloudflare is currently unable to resolve it. What can I do?
If you are a visitor of this website: Please try again in a few minutes.
If you are the owner of this website: Ensure that cloudflared is running and can reach the network. You may wish to enable load balancing for your tunnel. This common issues !! I have add private SSL to which works when someone wants to use in same network without tunnel. Install git SSL then run it, now HTTPS active.
Your LAN Messenger is ready to use with all features:
- β Instant messaging
- β Private chat
- β Channels
- β Voice messages
- β File sharing
- β Mobile support
Share the network URL with your team and start chatting! π
Questions? Check the troubleshooting section or review the server console logs for detailed diagnostics.