A full-stack real-time chat application built using Node.js, Express, and Socket.IO.
This project enables instant messaging with support for private chats, group conversations, user presence, and media sharing.
- ⚡ Real-time bi-directional communication using WebSockets
- 👤 User authentication (JWT / session-based — configurable)
- 💬 Private one-to-one messaging
- 👥 Group chat support
- 🟢 Online / Offline presence indicators
- ⌨️ Typing indicators
- 🖼️ Image sharing (optional via cloud storage)
- 📜 Chat history persistence (MongoDB / NoSQL)
- 🔒 Secure socket connections
- 📱 Responsive UI (if frontend included)
- Node.js
- Express.js
- Socket.IO
- MongoDB / Firebase / Supabase (configurable)
- JWT Authentication
- React.js
- Material UI / Custom CSS
- Axios
chat-app/
│
├── server/
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ ├── lib/
│ ├── middleware/
│ └── server.js
│
├── client/ # React frontend (optional)
│ ├── src/
│ └── public/
│
├── .env
├── package.json
└── README.md
git clone https://github.com/your-username/chat-app.git
cd chat-appcd server
npm installcd client
npm installCreate a .env file inside the server directory:
MONGO_URI=
JWT_SECRET=
PORT=3000
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
ARCJET_KEY=
ARCJET_ENV="development"npm run devnpm start| Event Name | Description |
|---|---|
join |
Join chat room / user session |
privateMessage |
Send private message |
groupMessage |
Send message to group |
typing |
User typing indicator |
stopTyping |
Stop typing indicator |
| Event Name | Description |
|---|---|
message |
Receive message |
userOnline |
User comes online |
userOffline |
User goes offline |
typing |
Show typing indicator |
notification |
New message notification |
- Client connects to server via Socket.IO
- User authentication is verified
- User joins personal and group rooms
- Messages are emitted in real-time
- Server broadcasts to relevant recipients
- Messages are optionally stored in database
- JWT authentication for socket connections
- CORS configuration
- Input validation
- Rate limiting (recommended for production)
- HTTPS deployment advised
- Render / Railway / AWS / DigitalOcean
- Vercel / Netlify / Firebase Hosting
- Voice & video calling (WebRTC)
- Message reactions & replies
- Read receipts
- Push notifications
- End-to-end encryption
- File sharing
Contributions are welcome!
- Fork the repository
- Create a new branch
- Commit your changes
- Push to your branch
- Open a Pull Request
This project is licensed under the MIT License.
Ashmit Aryan
If you like this project, please consider giving it a ⭐ on GitHub!