A modern, feature-rich real-time chat application built with Node.js, Express, React, and Socket.io. Connect with friends, share stories, and communicate seamlessly with an intuitive interface.
- User registration with email verification
- Secure JWT-based authentication
- Username uniqueness checking
- Avatar upload and management
- User profile with bio updates
- Account verification system
- Real-time messaging using WebSocket (Socket.io)
- Message editing and deletion
- Message reactions and emoji support
- Message pinning for important conversations
- Message starring for quick access
- File sharing capabilities
- Typing indicators
- Read receipts
- Add and remove friends
- Friend request system with pending requests
- Accept/reject friend requests
- Search friends functionality
- Advanced user search
- Block user functionality
- View friend lists
- Share temporary stories (like social media stories)
- Story creation with media uploads
- Story deletion
- View friend stories
- Modern, responsive UI with Tailwind CSS
- Smooth animations with Framer Motion
- Emoji picker for expressive messaging
- File upload with preview
- Dark/Light mode support
- Real-time notifications
- Framework: Express.js (Node.js)
- Real-time Communication: Socket.io
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: Bcrypt
- Email Service: Nodemailer
- File Upload: Multer
- CORS: Cross-Origin Resource Sharing enabled
- UI Framework: React 18
- Styling: Tailwind CSS
- HTTP Client: Axios
- Real-time Client: Socket.io Client
- Routing: React Router v6
- Animations: Framer Motion
- Video Processing: FFmpeg
- File Upload: FilePond
- Image Compression: Browser Image Compression
- Icons: React Icons
- Additional: Emoji Picker, JWT Decode, Lodash
Chat-App/
βββ backend/
β βββ config/ # Database configuration
β βββ controllers/ # Route controllers (Auth, User, Messages, etc.)
β βββ middlewares/ # Express middlewares (JWT validation, Socket auth)
β βββ models/ # MongoDB schemas (User, Message, Chat, Story)
β βββ routes/ # API routes
β βββ utils/ # Utility functions (file storage, helpers)
β βββ index.js # Main server file
β βββ websocket.js # Socket.io event handlers
β βββ package.json
β βββ .env # Environment variables
β
βββ frontend/
βββ src/
β βββ components/ # React components
β βββ App.jsx # Main App component
β βββ index.js # Entry point
β βββ index.css # Global styles
βββ public/ # Static assets
βββ package.json
βββ tailwind.config.js # Tailwind configuration
βββ .gitignore
- Node.js (v14 or higher)
- npm or yarn
- MongoDB (local or cloud instance)
- Modern web browser
-
Navigate to backend directory
cd backend -
Install dependencies
npm install
-
Create environment file (.env)
PORT=5000 MONGODB_URI=mongodb://localhost:27017/chat-app JWT_SECRET=your_jwt_secret_key BASE_URL=http://localhost:3000 EMAIL_USER=your_email@gmail.com EMAIL_PASSWORD=your_email_password
-
Start the server
# Development mode with hot reload npm run dev # Production mode npm start
The backend server will run on http://localhost:5000
-
Navigate to frontend directory
cd frontend -
Install dependencies
npm install
-
Create environment file (.env)
REACT_APP_API_URL=http://localhost:5000
-
Start the development server
npm start
The frontend will run on http://localhost:3000
POST /signup- Register new userPOST /login- User loginGET /verify-email- Email verificationPOST /check-username- Check username availabilityGET /checkSession- Check user session (Protected)GET /is-verified- Check if user is verified
GET /users/personalinfo/:userId- Get user profileGET /users/friends- Get user's friends listGET /users/search-friends- Search friendsGET /users/search- Search usersPOST /users/friend-request- Send friend requestGET /users/pending-friends- Get pending friend requestsPOST /users/accept-friend- Accept friend requestPOST /users/reject-friend- Reject friend requestPOST /users/remove-friend- Remove friendPOST /users/block-user- Block a userPOST /users/update-avatar- Update user avatarPOST /users/update-bio- Update user bio
GET /messages/get/:userId- Get messages with a userPOST /messages/send- Send message(s)DELETE /messages/delete/:messageId- Delete messagePOST /messages/star/:messageId- Star a messagePOST /messages/react/:messageId- Add reaction to messagePUT /messages/edit/:messageId- Edit messagePOST /messages/pin/:chatId- Pin message
GET /users/chats- Get all user chatsPOST /users/remove-chat- Remove a chat
POST /users/add-story- Create a storyPOST /users/delete-story- Delete a story
connection- User connects to socketdisconnect- User disconnects
send_message- Send a messagereceive_message- Receive a messageedit_message- Edit a messagedelete_message- Delete a messagetyping- Show typing indicatorstop_typing- Hide typing indicator
user_online- User comes onlineuser_offline- User goes offlinestatus_update- Status/presence update
- JWT authentication for API endpoints
- Socket.io authentication middleware
- Password hashing with Bcrypt
- CORS configuration for authorized origins
- Email verification system
- Protected routes requiring authentication
- Secure environment variable management
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
BASE_URL=http://localhost:3000
EMAIL_USER=your_email
EMAIL_PASSWORD=your_email_password
REACT_APP_API_URL=http://localhost:5000
- Navigate to signup page
- Fill in username, email, and password
- Upload profile picture (optional)
- Verify email from verification link
- Login with credentials
- Go to the search section
- Search for friends by username
- Click "Add Friend" to send a request
- Wait for friend to accept your request
- Select a friend from your chat list
- Type your message in the input field
- Click send or press Enter
- Messages appear in real-time
- Click on "Add Story" button
- Upload media file (image/video)
- Story appears for your friends
- Stories auto-delete after 24 hours (configurable)
- React: Click reaction icon to add emoji reactions
- Star: Star important messages for quick access
- Pin: Pin messages to keep them at the top
- Edit: Edit messages you've sent
- Delete: Remove messages
- Share Files: Upload and share files with friends
- Verify MongoDB is running
- Check MongoDB URI in .env
- Ensure port 5000 is not in use
- Check CORS configuration
- Verify backend is running on correct port
- Check REACT_APP_API_URL in .env
- Clear browser cache and cookies
- Check browser console for errors
- Verify Nodemailer configuration
- Check EMAIL_USER and EMAIL_PASSWORD in .env
- Enable "Less secure app access" for Gmail
- Check spam folder for verification email
express- Web frameworksocket.io- Real-time bidirectional communicationmongoose- MongoDB ODMjsonwebtoken- JWT authenticationbcrypt- Password hashingmulter- File upload handlingnodemailer- Email servicecors- Cross-origin resource sharing
react- UI libraryreact-router-dom- Routingaxios- HTTP clientsocket.io-client- Socket clienttailwindcss- CSS frameworkframer-motion- Animation library
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the ISC License - see the LICENSE file for details.
Created by Mina (@minaa66)
For support, email or create an issue in the GitHub repository.
- Express.js Documentation
- Socket.io Documentation
- React Documentation
- MongoDB Documentation
- Tailwind CSS Documentation
Last Updated: March 2026
Enjoy connecting with your friends! π