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!