A full-stack social messaging application built with the MERN stack (MongoDB, Express, React, Node.js) with real-time messaging capabilities using Socket.IO.
- 🔐 Authentication: Google OAuth and normal login/signup with JWT
- 👥 Friend System: Search users, send/accept/decline friend requests, mutual friends
- 💬 Real-time Chat: One-to-one messaging with Socket.IO
- 👨👩👧 Group Chat: Create groups and chat with multiple users
- 🔔 Notifications: Real-time notifications for friend requests and messages
- ⚙️ Settings: Dark/light theme, privacy settings, blocked users
- 🎨 Modern UI: Beautiful dark theme UI
- Node.js & Express
- MongoDB with Mongoose
- Socket.IO for real-time communication
- JWT for authentication
- Passport.js for Google OAuth
- bcryptjs for password hashing
- React 18
- React Router for navigation
- Socket.IO Client
- Axios for API calls
- React Icons
- React Toastify
- Node.js (v14 or higher)
- MongoDB Atlas account (or local MongoDB)
- Google OAuth credentials (for Google login)
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile in the backend directory:
PORT=5000
MONGODB_URI=your_mongodb_atlas_connection_string
JWT_SECRET=your_jwt_secret_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
CLIENT_URL=http://localhost:3000- Start the backend server:
npm run devThe backend will run on http://localhost:5000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Create a
.envfile in the frontend directory:
REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_SOCKET_URL=http://localhost:5000- Start the frontend development server:
npm startThe frontend will run on http://localhost:3000
.
├── backend/
│ ├── controllers/ # Request handlers
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── middleware/ # Auth middleware
│ ├── socket/ # Socket.IO handlers
│ └── server.js # Entry point
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── context/ # React Context providers
│ │ ├── services/ # API services
│ │ ├── styles/ # CSS files
│ │ └── utils/ # Utility functions
│ └── public/
└── README.md
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/google- Google OAuth loginGET /api/auth/me- Get current user
GET /api/users/:userId- Get user profilePUT /api/users/profile- Update profilePUT /api/users/settings- Update settingsPOST /api/users/block- Block userPOST /api/users/unblock- Unblock user
GET /api/friends/search?q=query- Search usersPOST /api/friends/request- Send friend requestPOST /api/friends/accept- Accept friend requestPOST /api/friends/decline- Decline friend requestGET /api/friends/suggestions- Get suggested users
GET /api/messages/chats- Get chat listGET /api/messages/chat/:userId- Get messages with userGET /api/messages/group/:groupId- Get group messagesPUT /api/messages/seen/:userId- Mark messages as seenDELETE /api/messages/:messageId- Delete message
POST /api/groups- Create groupGET /api/groups- Get user groupsGET /api/groups/:groupId- Get group detailsPUT /api/groups/:groupId- Update groupPOST /api/groups/:groupId/members- Add membersDELETE /api/groups/:groupId/members- Remove member
GET /api/notifications- Get notificationsGET /api/notifications/unread-count- Get unread countPUT /api/notifications/:id/read- Mark as readPUT /api/notifications/read-all- Mark all as read
sendMessage- Send a messagetyping- Send typing indicatormessageSeen- Mark message as seen
newMessage- New message receivedtyping- User is typingmessageSeen- Message was seenuserOnline- User came onlineuserOffline- User went offlinenewNotification- New notification
- Search for users by name, username, or email
- View mutual friends count
- Send friend requests
- Accept or decline friend requests
- Real-time notifications for friend requests
- One-to-one messaging between friends
- Real-time message delivery
- Message status (sent, delivered, seen)
- Typing indicators
- Online/offline presence
- Chat list sorted by latest activity
- Create groups with multiple members
- Group admins can add/remove members
- Real-time group messaging
- Group information management
- Real-time notification updates
- Friend request notifications
- Message notifications
- Unread notification count
- Mark as read functionality
- Dark/light theme toggle
- Privacy settings (last seen, read receipts)
- Blocked users management
- Profile customization
- JWT-based authentication
- Password hashing with bcrypt
- Protected API routes
- Socket.IO authentication
- Input validation
- Error handling
- Message reactions
- File sharing (images, videos)
- Voice/video calls
- Message search
- Message forwarding
- Profile status updates
- Last seen timestamps
- Read receipts toggle
This project is open source and available for portfolio and interview purposes.
Built as a portfolio project demonstrating full-stack development skills.