A secure one-on-one messaging application with real-time capabilities and image sharing.
This chat application provides a platform for direct messaging between users with real-time updates using Socket.IO. Features include user presence tracking, secure authentication, and support for both text and image messages.
- One-on-one real-time messaging
- Real-time online/offline status
- Image sharing via Cloudinary
- Secure authentication with Zod validation
- Unread message notifications
- Responsive design
-
Frontend:
- React.js with Vite
- Zustand for state management
- Socket.io-client
- Axios with interceptors
- React-toastify
-
Backend:
- Express.js
- MongoDB
- Socket.IO
- JWT authentication
- Zod validation
- Cloudinary integration
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number or special character
- Email validation
- Username (minimum 3 characters)
- JWT-based session management
- Protected routes using middleware
PORT=3000
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretPOST /api/auth/signup- New user registrationPOST /api/auth/login- User loginGET /api/auth/logout- User logoutPUT /api/auth/update-profile- Update user profileGET /api/auth/check- Verify authentication status
GET /api/messages/users- Fetch all available usersGET /api/messages/chat/:id- Get conversation historyPOST /api/messages/chat/:id- Send message (text/image)
- Instant message delivery
- Live user presence indicators
- Automatic connection management
- Message status updates
- Server-side socket event handling
- Clone the repository
- Install all dependencies:
npm install- Set environment variables
- Run development server:
npm run dev- For production:
npm run build
npm startThe application includes a build script that:
- Installs client dependencies
- Builds the client
- Installs server dependencies
- Starts the production server
MIT License