A full-stack real-time chat application built with WebSockets, React, and Node.js.
Deployed with a high-performance decoupled architecture.
🌐 Live Site: chat.zafarr.xyz
🔌 WebSocket API: wss://chat-api.zafarr.xyz
Features • Tech Stack • Architecture • Quick Start • Project Structure • Configuration
- Real-Time Global Chat: Instant broadcasting to all users.
- Private & Secret DMs: Direct 1-on-1 messaging with member selection.
- Voice Messages: Record and play audio notes with a custom UI player.
- Rich Media: Support for images, videos, files, and location pins.
- Live Camera: Capture and send photos directly from the browser.
- Typing Indicators: Real-time visual feedback when others are typing.
- Multi-Room Support: Join multiple channels simultaneously.
- Interactive Invites: Create groups and invite members via action cards.
- Persistent Status: Users can set custom status messages and avatars.
- Rate Limiting: Throttling to prevent spam and abuse.
- Dark/Light Mode: Smooth theme transitions with persisted preferences.
- Responsive Design: Mobile-first UI with framer-motion animations.
- React 19: Modern UI component library.
- Tailwind CSS v4: Utility-first styling with modern design tokens.
- Framer Motion: Smooth micro-interactions and transitions.
- Vite: Ultra-fast build tool and dev server.
- Node.js & TypeScript: Type-safe server logic.
- ws (WebSockets): Raw socket connections for maximum performance.
- Express: HTTP management and routing.
- PM2: Production process manager with auto-restart.
- Vercel: Static frontend hosting with global CDN.
- AWS EC2 (Ubuntu): High-performance backend hosting for persistent sockets.
- Cloudflare: DNS management and SSL/TLS termination.
- Nginx: Reverse proxy and load balancing.
ChatLo.io uses a Decoupled Architecture:
- Frontend (Vercel): Deployed at
chat.zafarr.xyz. It serves static assets globally. - Backend (AWS EC2): Deployed at
chat-api.zafarr.xyz. A dedicated Linux instance running Node.js managed by PM2. - Communication: The frontend connects to the backend via a secure
wss://WebSocket tunnel proxied through Nginx and Cloudflare.
ChatLo.io/
├── FE/ ← Frontend (React + Vite)
│ ├── src/context/ ← Core WebSocket Logic
│ └── src/components/ ← UI Components
├── BE/ ← Backend (Node.js + ws)
│ ├── src/handlers/ ← Socket Message Routing
│ └── src/services/ ← Business Logic
└── README.md
PORT: Server port (default 3000)AUTH_ENABLED: Toggle JWT authenticationWS_ALLOWED_ORIGINS: CORS whitelist for WebSocket origins
VITE_WS_URL: The production WebSocket endpoint (wss://chat-api.zafarr.xyz)
Made with ❤️ by Zafar
| Run compiled build | | Token | `npm run generate-token -- ` | Generate JWT || Script | Command | Description |
|---|---|---|
| Dev | npm run dev |
Vite dev server (port 5173) |
| Build | npm run build |
Production build |
| Preview | npm run preview |
Preview production build |
Made with ❤️ using WebSockets + React
