A full-stack real-time chat application built with React, TypeScript, Node.js, Express, MongoDB, and Socket.IO.
- π JWT Authentication - Secure login and signup
- π¬ Real-Time Messaging - Instant message delivery via Socket.IO
- π· Image Upload - Send images in chat (Cloudinary)
- π₯ Online Status - See who's online with green indicators
- π Unseen Message Counts - Red badges show unread messages
- β Message Status - Seen/unseen indicators (β/ββ)
- π€ Profile Management - Edit name, bio, and profile picture
- π± Responsive Design - Works seamlessly on mobile and desktop
- π¨ Modern UI - WhatsApp/Messenger-style interface
- React 19 - UI framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Socket.IO Client - Real-time communication
- Zustand - State management
- React Router - Navigation
- Axios - HTTP requests
- React Hot Toast - Notifications
- Lucide React - Icons
- Node.js - Runtime environment
- Express - Web framework
- TypeScript - Type safety
- MongoDB - Database
- Mongoose - ODM
- Socket.IO - Real-time communication
- JWT - Authentication
- Cloudinary - Image storage
- bcryptjs - Password hashing
- Node.js (v16 or higher)
- npm or yarn
- MongoDB Atlas account (or local MongoDB)
- Cloudinary account (for image uploads)
git clone <your-repo-url>
cd ChatAppcd server
npm installcd ../client
npm installCreate a server/.env file:
MONGODB_URI=your_mongodb_connection_string
PORT=5000
JWT_SECRET=your_jwt_secret_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secretCreate a client/.env file:
REACT_APP_API_URL=http://localhost:5000cd server
npm run devBackend will run on http://localhost:5000
cd client
npm startFrontend will open on http://localhost:3000
ChatApp/
βββ server/ # Backend (Node.js + Express)
β βββ src/
β β βββ config/ # Database configuration
β β βββ controller/ # Route controllers
β β βββ middleware/ # Auth middleware
β β βββ models/ # Mongoose models
β β βββ routes/ # API routes
β β βββ types/ # TypeScript types
β β βββ utils/ # Utilities (JWT, Cloudinary)
β β βββ index.ts # Entry point
β βββ .env # Environment variables
β βββ package.json
β βββ tsconfig.json
β
βββ client/ # Frontend (React + TypeScript)
βββ src/
β βββ components/ # React components
β βββ pages/ # Page components
β βββ store/ # Zustand stores
β βββ config/ # API configuration
β βββ lib/ # Socket.IO setup
β βββ types/ # TypeScript interfaces
β βββ utils/ # Utility functions
β βββ App.tsx # Main app component
β βββ index.tsx # Entry point
βββ public/
βββ .env # Environment variables
βββ package.json
βββ tailwind.config.js
βββ tsconfig.json
POST /api/auth/signup- Register new userPOST /api/auth/login- Login userGET /api/auth/check- Verify authenticationPUT /api/auth/update-profile- Update user profile
GET /api/messages/users- Get all users with unseen countsGET /api/messages/:id- Get messages with specific userPOST /api/messages/send/:id- Send message to userPUT /api/messages/mark/:id- Mark message as seen
connect- Connect with userId in query
getOnlineUsers- List of online user IDsnewMessage- New message received
- Sidebar Background:
#6A89A7 - Sent Messages:
#BDDDFC - Received Messages:
#88BDF2 - Dark Background:
#384959
- Sign Up: Create a new account with full name, email, password, and bio
- Login: Use your credentials to login
- Select User: Click on a user from the sidebar to start chatting
- Send Messages: Type text or upload images to send
- Real-Time: Messages appear instantly for both users
- Edit Profile: Click settings icon to update your profile
- Check if MongoDB connection string is correct
- Ensure port 5000 is not in use
- Verify all environment variables are set
- Make sure backend is running on port 5000
- Check
client/src/config/api.tshas correct API_URL - Verify CORS is enabled in backend
- Verify Cloudinary credentials in
.env - Check image size is under 4MB
- Ensure Cloudinary account is active
- Verify backend server is using
server.listen()notapp.listen() - Check browser console for connection errors
- Ensure userId is passed in socket connection
- Set environment variables on hosting platform
- Deploy backend code
- Update frontend API_URL to deployed backend URL
- Update
client/src/config/api.tswith production backend URL - Build:
npm run build - Deploy
build/folder
This project is open source and available under the MIT License.
Contributions, issues, and feature requests are welcome!
Your Name
- GitHub: @sugamghising
- React Team for React
- Tailwind CSS for the styling framework
- Socket.IO for real-time communication
- Cloudinary for image hosting
Happy Chatting! π¬β¨