Skip to content

πŸ’¬ ChatApp – A real-time chat application built with Socket.IO, React, Node.js, and Express. Supports live messaging and multiple users.

Notifications You must be signed in to change notification settings

aadityaexe/ChatApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

134 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ ChatApp

A full-stack real-time chat application built with the MERN stack β€” MongoDB, Express.js, React.js, and Node.js β€” designed to deliver a fast, secure, and modern messaging experience. The app enables users to send and receive messages instantly, create groups, share images, and manage conversations. Powered by Socket.IO, it provides a responsive and dynamic messaging interface.

πŸ“Œ WebRTC-based video calling is not yet implemented β€” planned for a future update.


πŸ“Έ Preview

Login Page Chat UI Group Chat
(Add screenshots here) (Add screenshots here) (Add screenshots here)

✨ Features

βœ… Core Functionality

  • πŸ” User Authentication using JWT
  • πŸ”’ Password hashing with Bcrypt
  • πŸ’¬ Real-time Chat using Socket.IO
  • πŸ‘₯ Private and Group Chat
  • πŸ“· Image Uploads using Multer
  • πŸ“₯ Media Preview in Chat UI
  • πŸ•’ Chat History with MongoDB Persistence

πŸ“ˆ Upcoming Features

  • πŸŽ₯ Video/Voice Calling with WebRTC
  • πŸ›ŽοΈ Push Notifications
  • πŸ”” Read Receipts and Typing Indicators
  • πŸ“Œ Message Pinning, Editing, and Deletion
  • πŸ”Ž Chat Search Functionality
  • πŸ§ͺ Unit & Integration Testing

🧰 Tech Stack

Layer Technologies
Frontend React.js, Tailwind CSS, React Router, React Icons, Axios, Socket.IO-Client
Backend Node.js, Express.js, MongoDB, Mongoose, Multer, JWT, Bcrypt, Socket.IO
Database MongoDB (NoSQL, document-oriented)
Authentication JWT (Access Token), Bcrypt (Password Hashing)
Deployment Render / Vercel (setup instructions below)

πŸ”§ Installation & Setup

πŸ“ Step 1: Clone the Repository

git clone https://github.com/aadityaexe/ChatApp.git
cd ChatApp

βš™οΈ Step 2: Backend Setup

cd Backend
npm install

Create a .env file

PORT=5000
MONGO_URI=your_mongo_connection_uri
JWT_SECRET=your_jwt_secret

Start Backend Server

npm run server

The server will start at http://localhost:5000.


πŸ–ΌοΈ Step 3: Frontend Setup

cd ../Frontend
npm install

Start Frontend

npm start

The React app will run at http://localhost:3000.


πŸ“‚ Project Structure

ChatApp/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ config/         # DB connection
β”‚   β”œβ”€β”€ controllers/    # Route logic
β”‚   β”œβ”€β”€ middleware/     # Auth middlewares
β”‚   β”œβ”€β”€ models/         # Mongoose models
β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”œβ”€β”€ uploads/        # Uploaded media
β”‚   └── server.js       # App entry point
β”œβ”€β”€ Frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/     # Images, icons
β”‚   β”‚   β”œβ”€β”€ components/ # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ context/    # User context
β”‚   β”‚   β”œβ”€β”€ pages/      # App pages (Login, Chat)
β”‚   β”‚   └── App.js      # App root
└── README.md

πŸ” Authentication

  • Passwords hashed with bcrypt
  • JWT tokens issued on login and stored in localStorage
  • Protected routes using middleware
  • User context maintained globally in frontend

πŸ”Œ WebSocket Integration

Implemented using Socket.IO on both server and client:

  • Join chat rooms
  • Send/receive messages instantly
  • Live updates for new messages
  • Future scope for online indicators and typing notifications

πŸ“€ File Uploads

  • Users can send and receive images (JPG, PNG, etc.)
  • Uploaded images are stored in Backend/uploads/
  • File preview shown inline in chat

πŸ“¦ API Endpoints (Sample)

Method Endpoint Description
POST /api/user/register Register a new user
POST /api/user/login Login and receive JWT
GET /api/chat/:id Fetch all messages for a chat
POST /api/message/ Send a message
POST /api/chat/group Create a new group chat

🌍 Deployment

Option 1: Deploy on Render (Backend)

  • Create a new Web Service on Render
  • Connect your GitHub repo
  • Add environment variables from .env
  • Set start command as:
npm run server

Option 2: Deploy on Vercel (Frontend)

  • Push the Frontend folder to a separate GitHub repo (or subtree split)
  • Import it on vercel.com
  • Set build command: npm run build
  • Set output directory: build

πŸ‘¨β€πŸ’» Contribution Guide

Contributions are welcome! Follow these steps:

  1. Fork this repo
  2. Create a new branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "Add your message"
  4. Push to your branch: git push origin feature/your-feature
  5. Open a Pull Request πŸš€

πŸ™‹β€β™‚οΈ Author

Aditya Kumar


πŸ“„ License

This project is licensed under the MIT License.

About

πŸ’¬ ChatApp – A real-time chat application built with Socket.IO, React, Node.js, and Express. Supports live messaging and multiple users.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages