Skip to content

Latest commit

 

History

68 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 Real-Time Chat Application (Socket.IO)

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.


🚀 Features

  • ⚡ 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)

🏗️ Tech Stack

Backend

  • Node.js
  • Express.js
  • Socket.IO
  • MongoDB / Firebase / Supabase (configurable)
  • JWT Authentication

Frontend (if applicable)

  • React.js
  • Material UI / Custom CSS
  • Axios

📂 Project Structure


chat-app/
│
├── server/
│   ├── controllers/
│   ├── models/
│   ├── routes/
│   ├── lib/
│   ├── middleware/
│   └── server.js
│
├── client/                # React frontend (optional)
│   ├── src/
│   └── public/
│
├── .env
├── package.json
└── README.md


⚙️ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/your-username/chat-app.git
cd chat-app

2️⃣ Install Dependencies

Backend

cd server
npm install

Frontend (if included)

cd client
npm install

3️⃣ Environment Variables

Create 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"

4️⃣ Run the Application

Start Backend Server

npm run dev

Start Frontend

npm start

🔌 Socket Events

Client → Server

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

Server → Client

Event Name Description
message Receive message
userOnline User comes online
userOffline User goes offline
typing Show typing indicator
notification New message notification

🧠 How It Works

  1. Client connects to server via Socket.IO
  2. User authentication is verified
  3. User joins personal and group rooms
  4. Messages are emitted in real-time
  5. Server broadcasts to relevant recipients
  6. Messages are optionally stored in database

🛡️ Security Considerations

  • JWT authentication for socket connections
  • CORS configuration
  • Input validation
  • Rate limiting (recommended for production)
  • HTTPS deployment advised

🚀 Deployment

Backend

  • Render / Railway / AWS / DigitalOcean

Frontend

  • Vercel / Netlify / Firebase Hosting

🧩 Future Improvements

  • Voice & video calling (WebRTC)
  • Message reactions & replies
  • Read receipts
  • Push notifications
  • End-to-end encryption
  • File sharing

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a new branch
  3. Commit your changes
  4. Push to your branch
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License.


👨‍💻 Author

Ashmit Aryan


⭐ Support

If you like this project, please consider giving it a ⭐ on GitHub!

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages