Real-Time-Chat-Application

⚡ Real-Time Chat Application (MERN + WebSockets)

A high-performance, full-stack chat application built with the MERN stack (MongoDB, Express.js, React.js, Node.js) and Socket.io for real-time, ultra-low-latency messaging. This project is architected for instant communication and scalable, event-driven data flows, making it a learning model for financial, HFT, or any real-time data streaming use case.


🏗️ Architecture Overview


🚀 Key Features


🖥️ Demo

🌍 Live Demo: https://chatapp-fdps.onrender.com


📦 Tech Stack

Backend

Frontend


📂 Project Structure

Real-Time-Chat-Application/
│
├── backend/
│   ├── src/
│   │   ├── controllers/      # Auth, Message controllers
│   │   ├── lib/              # Cloudinary, DB, Socket.io utils
│   │   ├── models/           # Mongoose schemas
│   │   ├── routes/           # Route definitions
│   │   └── index.js          # Entry point
│   ├── package.json
│   └── package-lock.json
│
├── frontend/
│   └── ...                   # React app source code
│
└── README.md

⚙️ Backend Environment Variables

Create a .env file in the backend folder:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
NODE_ENV=development

🏃‍♂️ Getting Started

1. Clone the Repository

git clone https://github.com/arpitKSi/Real-Time-Chat-Application.git
cd Real-Time-Chat-Application

2. Install Backend Dependencies

cd backend
npm install

3. Set Up Environment Variables

Add a .env file in backend/ as shown above.

4. Start the Backend Server

npm run dev

Server runs on http://localhost:5000 by default.

5. Install and Run Frontend

Note: The frontend source code is in the frontend/ folder. Install dependencies and run the dev server as per its README or setup instructions.


🛡️ API Overview

Authentication

Messaging


💬 Real-Time Communication (Socket.io)


🛠️ Core Code Highlights


🧑‍💻 Example Usage

Signup:

POST /api/auth/signup
{
  "fullName": "Alice Smith",
  "email": "alice@example.com",
  "password": "password123"
}

Send Message:

POST /api/messages/:receiverId
{
  "text": "Hello!",
  "image": "<base64 string, optional>"
}

🚧 Future Improvements


🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a pull request

📝 License

This project is [ISC Licensed].

📬 Contact

For questions, issues, or feature requests, please open an issue or contact @arpitKSi.