Skip to content

ghaemaliabadi/chat-room

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple and Fast Chat Room (Realtime)

The code is messy as hell, mostly because this project was started with zero internet access and built during a period of heavy internet censorship in Iran. Don’t expect elegance—expect shit getting done for survival.

What is this?

This project is a lightweight, single-file web chat room built with Node.js and no extra frameworks or databases. The UI is RTL-friendly and works well on mobile.

Persistence & Storage

This project has no database. All messages are stored in memory, with a small temporary cache under /tmp/enc_data to survive short restarts.

Photos

1 2 3 4 5 6 7

Features

  • Realtime chat with SSE (no WebSocket required)
  • Unlimited rooms based on URL path (e.g. /general)
  • Custom username stored in browser cookies
  • Online users and join/leave presence
  • “Typing” and “Uploading” status indicators
  • Message reactions (👍 👎 ❤️ 💩)
  • Replies with scroll-to-referenced message
  • Pin messages with the !pin command
  • “Seen” indicator for messages
  • File, image, voice, and video-note uploads with progress
  • Built-in voice and video players
  • Built-in emoji picker
  • Multiple themes (Telegram/Discord/Amoled/Sunset/Mint/Slate/Rose)
  • Message cache stored at /tmp/enc_data for partial persistence after restart

Upload Limits and Rules

  • Max file size: 100MB
  • Max voice size: 8MB
  • Max video size: 20MB
  • Allowed extensions: png, jpg, jpeg, gif, webp, pdf, txt, zip, mp4, mov, webm, mp3, wav, m4a, ogg, opus, apk, exe, deb

How to deploy

Just buy a Node.js instance from a PaaS like liara.ir and upload the project zip.

Run the Project

npm start
# or
node chat.js

Then open in your browser:

http://localhost:4000

To create a new room, just change the path:

http://localhost:4000/room-name

Special Chat Commands

  • Pin a message: !pin your message
  • Clear all messages: clearall342745, change it for your project

Technical Notes

  • The server runs over http only (HTTPS is currently disabled in code).
  • Messages are stored in memory with a ring limit of 300 per room.
  • Minimal, easy to customize and extend.

File Structure

  • chat.js: Node.js server and core logic
  • index.html: UI and client script
  • fonts/ and Vazirmatn-font-face.css: Persian font assets
  • notif.mp3: Notification sound

About

Single-File web chat room built with Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors