A lightweight, modern, and high-performance Real-Time Persian Messenger built using full-stack JavaScript. This project is specifically architected to support fluid, bidirectional communication with a seamless user experience tailored for Persian-speaking users.
The chat-app follows a decoupled client-server architecture to provide persistent connections and instant messaging capabilities:
- Handshake & Connection: When a user opens the client interface, a WebSocket handshake protocol is initiated with the Node.js server.
- Persistent Session: Once verified, a persistent, bi-directional TCP connection is established via WebSockets.
- Event-Driven Delivery: Messages are processed as asynchronous payloads. When User A sends a message, it triggers a server event which instantaneously broadcasts or selectively routes the message to User B's active socket session.
- Fallback Mechanism: If the client's network environment restricts native WebSockets, the pipeline automatically falls back to HTTP long-polling to preserve communication stability.
- Core Logic: JavaScript (ES6+)
- UI/UX Framework: React.js / Vanilla JS (with modular component architecture)
- Styling: CSS3 / Tailwind CSS (Optimized for RTL alignment and Persian typography)
- Runtime Environment: Node.js
- Application Framework: Express.js (Lightweight routing and middleware controller)
- Database Management: MongoDB / Mongoose (For unstructured message archiving, chat histories, and user metadata)
- Network Protocol: Socket.IO / Raw WebSockets (Bi-directional communication engine)
The engine operates on a event-driven schema designed for speed, consistency, and low-latency message delivery:
connection: Fires upon a successful socket handshake.join-room: Allocates the user to a private or group chat thread.send-message: Transmits the dynamic message body payload asynchronously.typing: Triggers a non-blocking notification indicating active user engagement.disconnect: Automatically cleans up active connection references to free up server overhead.
Follow these streamlined instructions to clone, configure, and execute the repository locally:
Make sure you have the following frameworks installed on your machine:
git clone https://github.com
cd chat-appIf the codebase uses a monorepo setup or split directories, navigate to both layers:
For the Backend:
cd backend
npm installFor the Frontend:
cd ../frontend
npm installCreate a .env file within your root server or backend directory and configure the environment variables:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/persian-chat-db
JWT_SECRET=your_super_secure_jwt_token_secretStart Backend Server:
cd backend
npm run dev # or node server.jsStart Frontend Client:
cd ../frontend
npm start # or npm run devOpen http://localhost:3000 in your web browser to interact with your instance.
- 🌐 Full RTL Support: Native alignment adjustments optimized specifically for Persian language UI rendering.
- ⚡ Instant Messaging: Dynamic updates without triggering standard webpage refreshes.
- 🔒 Secure Sessions: Ready for JSON Web Tokens (JWT) implementation to protect private communication corridors.
- 💾 Persistent Chat Logs: Robust database integration preventing history data loss on server restarts.