A real-time chat application built with the MERN stack and Socket.IO.
- Real-time messaging — messages appear instantly via WebSocket (Socket.IO)
- Online presence — see which contacts are currently online
- Image sharing — attach and send images in any conversation
- Profile pictures — upload and update your avatar (stored on Cloudinary)
- Theme switcher — 30+ DaisyUI themes, persisted across sessions
- JWT authentication — stateless auth via HTTP-only cookies
- Contact search — filter your contact list live by name
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, Tailwind CSS, DaisyUI |
| State | Zustand |
| Routing | React Router v7 |
| HTTP client | Axios |
| Real-time | Socket.IO (client) |
| Backend | Node.js, Express 5 |
| Database | MongoDB (Mongoose) |
| Real-time | Socket.IO (server) |
| File storage | Cloudinary |
| Auth | JWT + bcryptjs |
TalkToMe/
├── client/ # Vite + React frontend
│ └── src/
│ ├── components/ # Navbar, Sidebar, ChatContainer, MessageInput, …
│ ├── pages/ # HomePage, SignInPage, SignUpPage, ProfilePage, SettingPage
│ ├── store/ # Zustand stores (useAuthStore, useChatStore, useThemeStore)
│ └── lib/ # axios instance, utility helpers
└── server/ # Express backend
└── src/
├── controllers/ # auth.controller, message.controller
├── lib/ # db, cloudinary, socket, utils
├── middlewares/ # auth.middleware (JWT guard)
├── models/ # User, Message (Mongoose schemas)
└── routes/ # /api/auth, /api/message
- Node.js 18+
- MongoDB database (local or Atlas)
- Cloudinary account (for profile picture uploads)
Create server/.env:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
NODE_ENV=development# Install server dependencies
cd server
npm install
# Install client dependencies
cd ../client
npm installIn one terminal:
cd server
npm run dev # starts Express on http://localhost:5001In another terminal:
cd client
npm run dev # starts Vite dev server on http://localhost:5173Open http://localhost:5173.
All endpoints are prefixed with /api.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /signup |
— | Create a new account |
| POST | /signin |
— | Sign in, returns JWT cookie |
| POST | /logout |
— | Clear the auth cookie |
| PUT | /update-profile |
✓ | Update profile picture |
| GET | /check |
✓ | Verify current session |
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /users |
✓ | List all users except the caller |
| GET | /:id |
✓ | Get message history with a user |
| POST | /send-message |
✓ | Send a text or image message |
| Event | Direction | Payload | Description |
|---|---|---|---|
getOnlineUsers |
server → client | string[] |
Updated list of online user IDs |
newMessage |
server → client | Message |
Delivered to the recipient in real time |
- Sign up at
/signup— provide full name, email, and password (min 6 chars). - Sign in at
/signin— authenticates and sets an HTTP-only JWT cookie. - Select a contact from the sidebar to open a conversation.
- Send a message — type and press Enter (or Shift+Enter for a new line), or click the image icon to attach a photo.
- Update your profile at
/profile— click the camera icon to upload a new avatar. - Change the theme at
/setting— pick from 30+ themes; the choice is saved locally.