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.
🌍 Live Demo: https://chatapp-fdps.onrender.com
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
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
git clone https://github.com/arpitKSi/Real-Time-Chat-Application.git
cd Real-Time-Chat-Application
cd backend
npm install
Add a .env
file in backend/
as shown above.
npm run dev
Server runs on http://localhost:5000
by default.
Note: The frontend source code is in the
frontend/
folder. Install dependencies and run the dev server as per its README or setup instructions.
POST /api/auth/signup
— Register new usersPOST /api/auth/login
— User loginPOST /api/auth/logout
— User logoutPUT /api/auth/update-profile
— Update user profile picture (Cloudinary upload)GET /api/auth/check-auth
— Check current authentication statusGET /api/messages/users
— Get all users (except self)GET /api/messages/:id
— Get messages between logged-in user and user with :id
POST /api/messages/:id
— Send a message (optionally with image) to user :id
newMessage
— Real-time delivery of new messages.lib/utils.js
).auth.controller.js
).lib/cloudinary.js
).lib/socket.js
for scalability and multi-user support.http://localhost:5173
) and production use.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>"
}
git checkout -b feature/your-feature
)git commit -am 'Add new feature'
)git push origin feature/your-feature
)This project is [ISC Licensed].
For questions, issues, or feature requests, please open an issue or contact @arpitKSi.