Live Demo: https://real-time-chat-app-rq6r.onrender.com
This project is a real-time chat application built with the MERN stack (MongoDB, Express, React, Node.js), Socket.io for real-time communication, and styled with TailwindCSS and DaisyUI. It features authentication, authorization, online user status, global state management, and robust error handling.
A real-time chat application enables users to communicate instantly, making it ideal for:
- Team collaboration: Facilitates quick decision-making and seamless teamwork.
- Customer support: Provides immediate assistance to users, improving satisfaction.
- Social interaction: Connects friends, family, or communities in real time.
- Business communication: Enhances productivity by reducing delays in information exchange.
- Learning environments: Supports group discussions and instant feedback in educational settings.
This application demonstrates how modern web technologies can be combined to deliver a fast, interactive, and reliable messaging experience.
- Tech stack: MERN (MongoDB, Express, React, Node.js), Socket.io, TailwindCSS, DaisyUI
- Authentication and authorization using JWT
- Real-time messaging with Socket.io
- Online user status tracking (Socket.io and React Context)
- Global state management with Zustand
- Comprehensive error handling on both server and client sides
- Node.js (v16 or higher recommended)
- npm (v8 or higher recommended)
- MongoDB instance (local or MongoDB Atlas)
git clone https://github.com/your-username/your-repo.git
cd your-repo
npm install
npm install --prefix frontend
Create a .env file in the root or backend directory with the following content:
MONGO_DB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT=5000
npm run build
npm start
The backend server will start and serve the built frontend at http://localhost:5000 by default.
- To run the backend in development mode with hot-reloading:
npm run dev - To run the frontend development server with hot-reloading:
The frontend will be available at
cd frontend npm run devhttp://localhost:5173by default.
This application can be deployed on platforms such as Render, Railway, or Heroku. For deployment on Render:
- Push your code to a GitHub repository.
- Create a new Web Service on Render and connect your repository.
- Set the build command to:
npm install && npm install --prefix frontend && npm run build - Set the start command to:
npm start - Add the required environment variables (
MONGO_DB_URI,JWT_SECRET,PORT). - Deploy the service. Render will provide a public URL for your application.
This project is licensed under the ISC License.