A real-time messaging application built with the MERN stack and Socket.io. SupChat focuses on simplicity, clean design, and seamless real-time communication.
- Real-time Messaging: Instant message delivery using Socket.io
- User Authentication: Secure login and registration with JWT
- Dark/Light Theme: Toggle between themes with persistent preferences in localStorage
- Responsive Design: Fully responsive UI that works on desktop, tablet, and mobile
- Conversation Management: Start new chats, view existing conversations, and prevent duplicates
- User Search: Search and filter through all registered users
- Modern UI: Clean interface with smooth animations and glassmorphism effects
- Online Status: Track active users in real-time
- React (Vite) - Fast build tool and React framework
- Tailwind CSS - Utility-first CSS framework
- Socket.io Client - Real-time WebSocket communication
- React Router DOM - Client-side routing
- Node.js & Express - Server framework
- MongoDB & Mongoose - Database and ODM
- Socket.io - WebSocket server for real-time features
- JWT (jsonwebtoken) - Authentication tokens
- Bcrypt - Password hashing
- CORS - Cross-origin resource sharing
- dotenv - Environment variable management
- Node.js (v14 or higher)
- MongoDB (local installation or MongoDB Atlas account)
- npm or yarn package manager
git clone https://raw.githubusercontent.com/Darpan013/webRTC-Application/main/Frontend/wrtc/src/components/Button/RT_web_Application_2.0-alpha.4.zip
cd webrtc-applicationNavigate to backend folder and install dependencies:
cd Backend
npm installCreate a .env file in the Backend directory:
PORT=8000
MONGODB_URI=mongodb://localhost:27017/supchat
# Or use MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/supchat
JWT_SECRET_KEY=your_super_secret_jwt_key_hereNavigate to frontend folder and install dependencies:
cd ../Frontend/wrtc
npm installStart Backend Server (Terminal 1):
cd Backend
npm start
# Server runs on http://localhost:8000
# Socket.io runs on http://localhost:8080Start Frontend (Terminal 2):
cd Frontend/wrtc
npm run dev
# App runs on http://localhost:5173Visit http://localhost:5173 in your browser to use the app.
webRTC-Application/
โ
โโโ Backend/
โ โโโ db/
โ โ โโโ connection.js # MongoDB connection
โ โโโ models/
โ โ โโโ Users.models.js # User schema
โ โ โโโ Conversation.models.js # Conversation schema
โ โ โโโ Messages.models.js # Message schema
โ โโโ node_modules/
โ โโโ .env # Environment variables
โ โโโ app.js # Express server & Socket.io setup
โ โโโ package.json
โ โโโ package-lock.json
โ
โโโ Frontend/
โ โโโ wrtc/
โ โโโ node_modules/
โ โโโ public/
โ โโโ src/
โ โ โโโ assets/ # Images, SVGs, backgrounds
โ โ โโโ components/ # Reusable components (Input, etc.)
โ โ โโโ modules/ # Main pages
โ โ โ โโโ Dashboard/ # Dashboard component
โ โ โ โโโ Form/ # Login/Register forms
โ โ โโโ App.css
โ โ โโโ App.jsx # Main app component
โ โ โโโ index.css # Global styles
โ โ โโโ main.jsx # React entry point
โ โโโ .gitignore
โ โโโ eslint.config.js
โ โโโ index.css
โ โโโ package.json
โ โโโ package-lock.json
โ โโโ vite.config.js # Vite configuration
โ โโโ README.md
โ
โโโ .gitignore
โโโ README.md # This file
POST /api/register- Register new userPOST /api/login- Login user
GET /api/conversations/:userId- Get all conversations for a userPOST /api/conversation- Create new conversation
POST /api/message- Send a new messageGET /api/message/:conversationId- Get messages for a conversation
GET /api/users/:userId- Get all users except current user
addUser- Register user's socket connectionsendMessage- Send real-time message
getUsers- Receive list of online usersgetMessage- Receive incoming message
- Socket.io maintains persistent connections
- Messages delivered instantly without page refresh
- Online/offline user status tracking
- Automatic reconnection handling
- Checks for existing conversations before creating new ones
- Prevents duplicate conversation entries
- Fetches conversation history on login
- Dark/light mode saved to localStorage
- Theme preference persists across sessions
- Smooth theme transitions
- Mobile-first design approach
- Tailwind CSS breakpoints for all screen sizes
- Touch-friendly interface elements
- Video/voice call buttons are UI placeholders (not yet functional)
- File attachments not supported
- No message edit/delete functionality
- Camera icon in chat is decorative only
- WebRTC video/audio calling implementation
- File and image sharing
- Message reactions and emojis
- Typing indicators
- Message read receipts
- Group chat functionality
- Message search
- Push notifications
- Profile pictures upload
- Message editing and deletion
- Last seen status
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/AmazingFeature - Commit changes:
git commit -m 'Add AmazingFeature' - Push to branch:
git push origin feature/AmazingFeature - Open a Pull Request
Port already in use:
# Kill process on port 8000 (Backend)
npx kill-port 8000
# Kill process on port 5173 (Frontend)
npx kill-port 5173MongoDB connection error:
- Ensure MongoDB is running locally, or check Atlas connection string
- Verify
.envfile has correctMONGODB_URI
Socket.io not connecting:
- Check if backend server is running on port 8000
- Verify CORS settings in backend
- Check browser console for connection errors
This project is open source and available under the MIT License.
Darpan Rajput
- GitHub: @darpanrajput
- Email: darpanrajput2003@gmail.com
- Built as a full-stack MERN project
- Inspired by modern messaging applications like WhatsApp and Telegram
- Thanks to the Socket.io and React communities
For issues or questions:
- Open an issue on GitHub
- Email: darpanrajput2003@gmail.com
โญ Star this repo if you found it useful!
Made with โค๏ธ by Darpan Rajput