A modern, full-featured real-time chat application built with the MERN stack (MongoDB, Express, React, Node.js). It features secure user authentication, real-time messaging with Socket.io, group chats, and a beautiful UI.
- JWT Authentication - Secure login and registration
- Password Hashing - bcrypt for secure password storage
- Profile Management - Update user details and avatar
- Secure Cookies - HTTP-only cookies for token storage
- Instant Messaging - Powered by Socket.io
- Typing Indicators - See when others are typing
- Online Status - Real-time online/offline status
- Read Receipts - Know when messages are read
- One-to-One Chats - Private direct messages
- Group Chats - Multi-user conversations
- Modern Design - Clean interface with TailwindCSS
- Responsive - Works on mobile, tablet, and desktop
- Toast Notifications - Real-time alerts for actions
- Loading States - Smooth skeletons and spinners
- React 18 - UI library
- TailwindCSS - Styling
- Socket.io Client - Real-time communication
- Axios - API requests
- React Router v6 - Routing
- Lucide React - Icons
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- Socket.io - WebSocket server
- JWT - Authentication
- Node.js (v14.x or higher)
- npm or yarn
- MongoDB (Local or Atlas)
π¨ Security Note: This project relies on environment variables for sensitive configuration (Database connections, Secrets). The
.envfiles are ignored by git to protect your security. Never commit your.envfiles to version control.
# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create .env file
# Copy the example or create new one with:
# PORT=5000
# MONGODB_URI=your_mongodb_connection_string
# JWT_SECRET=your_secret_key
# CLIENT_URL=http://localhost:3000
# Start the server
npm run dev# Navigate to Frontend directory
cd Frontend
# Install dependencies
npm install
# Create .env file
# REACT_APP_API_URL=http://localhost:5000/api
# REACT_APP_SOCKET_URL=http://localhost:5000
# Start the application
npm startAccess the application at http://localhost:3000
chat/
βββ backend/ # Node.js/Express Backend
β βββ config/ # Database config
β βββ controllers/ # Route controllers
β βββ middleware/ # Auth & Error middleware
β βββ models/ # Mongoose models
β βββ routes/ # API routes
β βββ socket/ # Socket.io logic
β βββ server.js # Entry point
β
βββ Frontend/ # React Frontend
β βββ src/
β β βββ components/ # UI Components
β β βββ context/ # React Context (Auth)
β β βββ pages/ # Page Components
β β βββ services/ # API & Socket services
β β βββ styles/ # Global styles
β β βββ utils/ # Helper functions
β βββ public/ # Static assets
β βββ package.json
β
βββ README.md
| Route | Component | Description |
|---|---|---|
/login |
UserLogin | Sign in to account |
/register |
UserRegistration | Create new account |
/chat-dashboard |
ChatDashboard | Main chat interface |
/new-chat |
NewChatCreation | Start new conversation |
/settings |
UserProfileSettings | Manage profile |
npm start- Runs the app in development modenpm run build- Builds the app for production
npm run dev- Runs server with Nodemonnpm start- Runs server in production mode
- Backend Integration - Connected to Express/MongoDB
- Real-time Messaging - Socket.io integration
- Database - MongoDB integration
- Authentication - JWT token-based auth
- State Management - Context API for Auth
- Fork the repository
- Create 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
This project is licensed under the MIT License.