A full-stack real-time chat application with user authentication, friend system, and file sharing. Built with React + Vite frontend and Express + MongoDB backend with Socket.IO for real-time messaging.
- Real-time Messaging: Instant messaging with Socket.IO
- User Authentication: Complete auth system with JWT and bcrypt
- Friend System: Send/accept friend requests and manage connections
- File Sharing: Image upload and sharing with Cloudinary integration
- User Profiles: Customizable user profiles with avatar support
- Online Status: Real-time online/offline user status
- Message Status: Read receipts and message delivery status
- Modern UI: React 19, Tailwind CSS 4, Lucide icons, toast notifications
- Responsive Design: Mobile-first responsive interface
- Search Users: Find and connect with other users
- Dashboard: Comprehensive dashboard with multiple views
Frontend:
- React 19 with Vite 7
- Tailwind CSS 4 with Vite plugin
- React Router DOM 7
- Socket.IO Client 4
- Axios for API calls
- React Hot Toast for notifications
- Lucide React for icons
- Moment.js for date formatting
- React Typewriter effects
- Lodash debounce for search optimization
Backend:
- Node.js with Express 5
- MongoDB with Mongoose 8
- Socket.IO 4 for real-time communication
- JWT for authentication
- bcryptjs for password hashing
- Cloudinary for file storage
- Multer for file uploads
- CORS for cross-origin requests
Development Tools:
- ESLint for code linting
- Nodemon for development
- Vercel deployment configuration
Chatr/
app/ # React + Vite frontend
src/
Pages/
Dashboard/ # Dashboard components
components/ # Reusable UI components
context/
assets/ # Static assets
main.jsx # App bootstrap
App.jsx # Main app with routing
server/ # Express backend
configs/
controllers/
middleware/
models/
routes/
uploads/ # Temporary file storage
server.js # Main server file with Socket.IO
package.json
vercel.json # Vercel deployment config
README.md
- Node.js 18+ and npm
- MongoDB connection string
- Cloudinary account (for file uploads)
Create two .env files—one for the frontend and one for the backend.
Frontend: app/.env
VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_keyBackend: server/.env
MONGODB_URL=your_mongodb_connection_url
CLERK_SECRET_KEY=your_clerk_secret_key
CLERK_WEBHOOK_SECRET=your_clerk_webhook_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
JWT_SECRET=your_jwt_secret_keyInstall dependencies in both workspaces:
# Frontend dependencies
cd app && npm install
# Backend dependencies
cd ../server && npm installOpen two terminals:
1) Frontend (Vite dev server):
cd app
npm run devThe frontend will run on http://localhost:5173
2) Backend (Express + Socket.IO):
cd server
npm startThe backend will run on http://localhost:3002
Frontend (app):
npm run dev– Start Vite dev servernpm run build– Production buildnpm run preview– Preview built app locallynpm run lint– Lint the frontend codebase
Backend (server):
npm start– Start the server with Nodemon
User Model:
- Authentication credentials
- Profile information (name, avatar, bio)
- Friends list and pending requests
- Online status
Chat Model:
- Chat participants
- Chat metadata
- Last message reference
Message Model:
- Message content and type
- Sender and chat references
- Timestamps and read status
- File attachments
Authentication System:
- JWT-based authentication
- Password hashing with bcrypt
- Protected routes and middleware
- User registration and login
Real-time Messaging:
- Socket.IO integration
- Message delivery and read receipts
- Online/offline status tracking
- Room-based chat organization
Friend System:
- Send and receive friend requests
- Accept/decline functionality
- Friends list management
- User search and discovery
File Sharing:
- Cloudinary integration for image storage
- Multer middleware for file uploads
- Image preview and sharing in chats
- Profile avatar uploads
The project includes Vercel configuration for easy deployment:
- Frontend: Deploy the
appdirectory - Backend: Deploy the
serverdirectory withvercel.jsonconfig
- Ensure both
.envfiles are present and correctly configured - Verify MongoDB connection and database accessibility
- Check Cloudinary credentials for file upload functionality
- Confirm JWT secret is set for authentication
- Make sure both frontend and backend servers are running
- Verify Socket.IO connection on port 3002
- Check CORS configuration for cross-origin requests

