Real-time chat with Socket.io. Add friends, see who's online, chat instantly.
- Register/login
- Search & add friends
- Real-time messaging
- Online/offline status
- Typing indicators
- Read receipts
Frontend: React, Socket.io-client
Backend: Node.js, Express, Socket.io
DB: MongoDB
Auth: JWT
Backend:
cd server
npm install
npm startPort: 5002
Frontend:
cd client
npm install
npm startPort: 3000
server/.env:
PORT=5002
MONGODB_URI=mongodb://localhost:27017/chatapp
JWT_SECRET=your_secret_key- Make an account
- Click "Add Friend" and search for users
- Click on a friend to chat
- Type and send messages
Client sends:
join- go onlinesendMessage- send msgtyping- typing status
Server sends:
receiveMessage- new messageuserOnline/userOffline- status updates
| Route | What it does |
|---|---|
| POST /api/auth/register | Sign up |
| POST /api/auth/login | Log in |
| GET /api/users/search | Find users |
| GET /api/users/friends | My friends |
| POST /api/users/friends/:id | Add friend |
| GET /api/messages/:userId | Chat history |
Built to learn Socket.io and real-time features.