A modern, full-stack real-time chat application built with React and Socket.IO. TalkM enables seamless communication through instant messaging, room-based chats, and live user presence tracking with a sleek, responsive interface.
- Instant Message Delivery: Messages sent and received in real-time using WebSocket technology
- Message Acknowledgments: Visual confirmation when messages are delivered
- Typing Indicators: See when other users are typing a message
- Message History: Persistent chat history with smooth scrolling
- Group Chats: Create and join chat rooms for team discussions
- Private Messaging: One-on-one conversations with individual users
- Room Management: Easy navigation between different chat rooms
- Active Room Indication: Visual feedback for current active room
- Online Status: Real-time tracking of active users
- User List: View all currently online users in the chat
- Join/Leave Notifications: Get notified when users enter or exit rooms
- Active User Count: See how many people are currently online
- Secure User Authentication: Protected login and registration system
- Session Management: Automatic session handling for smooth user experience
- Secure Logout: Properly managed user disconnection
- JWT Token Integration: Secure token-based authentication
- Clean & Modern Design: Intuitive interface built with modern CSS
- Responsive Layout: Seamless experience across desktop, tablet, and mobile
- Message Bubbles: Distinct visual styling for sent and received messages
- Smooth Animations: Polished transitions and loading states
- Emoji Support: Rich text messaging with emoji reactions
- Notification System: Alerts for new messages when away
- Offline Message Queue: Messages stored when offline and sent when reconnected
- Auto-Reconnection: Automatic reconnection on connection loss
- Scroll to Latest: Quick navigation to the newest messages
- React 18 - Modern UI library with hooks
- Socket.IO Client - Real-time bidirectional communication
- Vite - Lightning-fast build tool and dev server
- React Router - Client-side routing
- Axios - HTTP client for API requests
- CSS3 - Modern styling with flexbox and grid
Backend (Repository: chatweb_backend)
- Node.js - JavaScript runtime
- Express.js - Web application framework
- Socket.IO - WebSocket library for real-time features
- MongoDB - NoSQL database for data persistence
- JWT - Secure authentication tokens
- bcrypt - Password hashing
- ESLint - Code linting and quality
- Git - Version control
- Node.js (v16 or higher)
- npm or yarn package manager
- Backend server running (see backend repository)
- Clone the repository
git clone https://github.com/Bisha18/chatweb_frontend.git
cd chatweb_frontend- Install dependencies
npm install
# or
yarn install- Set up environment variables
Create a .env file in the root directory:
VITE_API_URL=http://localhost:5000
VITE_SOCKET_URL=http://localhost:5000Note: Replace with your backend server URL. For production, use your deployed backend URL.
- Start the development server
npm run dev
# or
yarn devThe application will be available at http://localhost:5173
npm run build
# or
yarn buildThe optimized production build will be in the dist directory.
npm run preview
# or
yarn previewchatweb_frontend/
βββ public/ # Static assets
β βββ vite.svg # App icon
βββ src/
β βββ components/ # React components
β β βββ Chat/ # Chat interface components
β β βββ Auth/ # Authentication components
β β βββ Sidebar/ # User list and rooms
β β βββ Common/ # Reusable UI components
β βββ contexts/ # React context providers
β β βββ AuthContext.jsx
β β βββ SocketContext.jsx
β βββ hooks/ # Custom React hooks
β β βββ useSocket.js
β β βββ useAuth.js
β βββ services/ # API and Socket services
β β βββ api.js
β β βββ socket.js
β βββ utils/ # Utility functions
β βββ styles/ # CSS stylesheets
β βββ App.jsx # Main application component
β βββ main.jsx # Application entry point
βββ .env # Environment variables
βββ package.json # Project dependencies
βββ vite.config.js # Vite configuration
TalkM uses Socket.IO to establish a persistent WebSocket connection between the client and server:
- Bi-directional communication for instant message delivery
- Event-driven architecture for efficient data transfer
- Automatic reconnection on network interruptions
- Room-based message broadcasting
- User sends a message through the UI
- Message is emitted to the server via Socket.IO
- Server validates and broadcasts to relevant recipients
- Recipients receive the message in real-time
- Message is stored in the database for persistence
The application tracks user activity through:
- Socket connection events (connect/disconnect)
- Heartbeat mechanism to detect inactive users
- Real-time updates of the online user list
- Room-specific presence information
- User registers or logs in through the auth form
- Backend validates credentials and issues JWT token
- Token is stored in localStorage
- Token is sent with all API requests and Socket connections
- Session is maintained until user logs out
- ChatWindow: Main conversation display area
- MessageInput: Text input with send functionality
- UserList: Sidebar showing online users
- RoomList: Navigation for different chat rooms
- AuthForm: Login and registration interface
- MessageBubble: Individual message display
- TypingIndicator: Shows when users are typing
- NotificationBadge: Unread message counter
Client Emits:
join_room- Join a specific chat roomsend_message- Send a new messagetyping- Notify others of typing statusleave_room- Leave a chat room
Client Listens:
receive_message- Receive new messagesuser_joined- User joined notificationuser_left- User left notificationtyping_status- Someone is typingonline_users- Updated list of online users
POST /api/auth/register - Register new user
POST /api/auth/login - User login
GET /api/auth/verify - Verify JWT token
GET /api/messages/:roomId - Fetch message history
POST /api/rooms/create - Create new chat room
GET /api/rooms - Get all available rooms
This frontend connects to the TalkM backend server. To set up the complete application:
- Clone the backend repository: chatweb_backend
- Follow the backend setup instructions
- Ensure both frontend and backend are running
- Configure the
.envfile with correct backend URLs
- Connect to Vercel
npm install -g vercel
vercel login- Deploy
vercel --prodOr connect your GitHub repository to Vercel for automatic deployments.
Set these in your Vercel dashboard:
VITE_API_URL=https://your-backend-url.com
VITE_SOCKET_URL=https://your-backend-url.com
Visit the live application: talksyweb.vercel.app
TalkM is compatible with:
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Mobile)
- All passwords are hashed using bcrypt
- JWT tokens for secure authentication
- Environment variables for sensitive data
- CORS properly configured
- XSS protection implemented
- Socket connections authenticated
- File/image sharing not yet implemented
- Voice/video calls not available
- Message edit/delete functionality pending
- File and image sharing
- Message reactions (emoji)
- User profiles with avatars
- Voice and video calls
- Message search functionality
- Dark mode theme
- Message encryption (E2E)
- Desktop notifications
- Mobile app (React Native)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
This project is open source and available under the MIT License.
Bishal Paul
- GitHub: @Bisha18
- LinkedIn: Bishal Paul
- Email: d.bishalpaul@gmail.com
- Portfolio: [Coming Soon]
- Socket.IO for real-time communication
- React for the amazing UI library
- Vite for the blazing-fast build tool
- Vercel for hosting and deployment
- All contributors and testers
This project is actively maintained and open for contributions. Feel free to report issues or suggest new features!
- Backend: chatweb_backend
Made with β€οΈ by Bishal Paul