π¬ Chat App
A full-stack real-time chat application built with React and Node.js, featuring instant messaging, media sharing, status updates, and more.
- Email-based OTP authentication
- User profile management with profile pictures
- Online/offline status tracking
- Last seen functionality
- User verification system
- Real-time messaging using Socket.io
- One-on-one conversations
- Message status tracking (sent, delivered, read)
- Image and video sharing
- Message timestamps
- WhatsApp-like status updates
- View and manage status posts
- Modern, responsive UI built with Tailwind CSS
- Smooth animations with Framer Motion
- Toast notifications
- Dark/Light theme support
- Real-time updates
- React 19.1.1 - UI library
- Vite 7.1.7 - Build tool and dev server
- React Router DOM 7.9.5 - Routing
- Zustand 5.0.8 - State management
- Tailwind CSS 4.1.17 - Styling
- Radix UI - Accessible UI components
- Framer Motion 12.23.24 - Animations
- Socket.io Client - Real-time communication
- Axios 1.13.2 - HTTP client
- React Toastify 11.0.5 - Notifications
- Node.js - Runtime environment
- Express 5.1.0 - Web framework
- Socket.io 4.8.1 - Real-time communication
- MongoDB with Mongoose 8.19.2 - Database
- JSON Web Token (JWT) 9.0.2 - Authentication
- Nodemailer 7.0.10 - Email service (OTP)
- Multer 2.0.2 - File upload handling
- Cloudinary 2.8.0 - Image/video storage
- ImageKit 6.0.0 - Image processing
- Twilio 5.10.4 - SMS services (optional)
- Express Rate Limit 8.2.1 - Rate limiting
- CORS 2.8.5 - Cross-origin resource sharing
- Cookie Parser 1.4.7 - Cookie handling
chat-app/
βββ backend/
β βββ config/ # Configuration files (Cloudinary, ImageKit)
β βββ controllers/ # Route controllers
β βββ db/ # Database connection
β βββ middlewares/ # Auth, upload, etc.
β βββ models/ # Mongoose models (User, Message, Conversation, Status)
β βββ routes/ # API routes
β βββ services/ # Socket.io service
β βββ utils/ # Utility functions
β βββ server.js # Entry point
β
βββ frontend/
β βββ public/ # Static assets
β βββ src/
β β βββ components/ # Reusable components
β β βββ pages/ # Page components
β β βββ routes/ # Route configuration
β β βββ services/ # API services
β β βββ store/ # Zustand stores
β β βββ utils/ # Utility functions
β βββ index.html
β βββ vite.config.js
β
βββ README.md
- Node.js (v18 or higher)
- MongoDB (local or cloud instance like MongoDB Atlas)
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd chat-app
-
Install backend dependencies
cd backend npm install -
Install frontend dependencies
cd ../frontend npm install
-
Backend Environment Variables
Create a
.envfile in thebackenddirectory:PORT=8000 MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key FRONTEND_URL=http://localhost:5173 # Email Configuration (for OTP) EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_USER=your_email@gmail.com EMAIL_PASS=your_email_password # Cloudinary Configuration CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
-
Frontend Environment Variables
Create a
.envfile in thefrontenddirectory (if needed):VITE_API_URL=http://localhost:8000/api
-
Start the backend server
cd backend npm startThe server will start on
http://localhost:8000 -
Start the frontend development server
cd frontend npm run devThe frontend will be available at
http://localhost:5173
POST /api/auth/send-otp- Send OTP to emailPOST /api/auth/verify-otp- Verify OTP and loginPUT /api/auth/update-profile- Update user profile (requires auth)GET /api/auth/logout- Logout user (requires auth)GET /api/auth/check-auth- Check authentication status (requires auth)GET /api/auth/get-all-users- Get all users (requires auth)
GET /api/chat/conversations- Get all conversations (requires auth)POST /api/chat/send-message- Send a message (requires auth)GET /api/chat/messages/:conversationId- Get messages for a conversation (requires auth)
GET /api/status- Get all statuses (requires auth)POST /api/status- Create a new status (requires auth)DELETE /api/status/:statusId- Delete a status (requires auth)
The app uses JWT (JSON Web Tokens) for authentication. After verifying the OTP, users receive a JWT token that is stored in HTTP-only cookies for security.
- Instant message delivery using Socket.io
- Message status updates (sent, delivered, read)
- Typing indicators (if implemented)
- Online/offline user presence
- Upload and share images
- Upload and share videos
- Media stored in Cloudinary/ImageKit
- Optimized delivery
- Customizable profile pictures
- About/bio section
- Online status indicator
npm start- Start the server with nodemon (auto-reload on changes)
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- Rate limiting to prevent abuse
- JWT-based authentication
- HTTP-only cookies for token storage
- CORS configuration
- Input validation
- Secure file upload handling
- Group chat functionality
- Message encryption
- Push notifications
- File sharing (documents, PDFs)
- Message search
- Chat backups
- Read receipts
Contributions are welcome! Please feel free to submit a Pull Request.
For support, email beingaditya198@gmail.com or create an issue in the repository.
Built with β€οΈ using React and Node.js