๐ฌ MERN Chat App
A real-time full-stack chat application built with the MERN Stack, Socket.IO, JWT (Cookies), ImageKit, and styled beautifully using DaisyUI + Tailwind CSS.
๐ Features
- ๐ JWT Authentication with HTTP-only cookies
- โก Real-time Messaging using Socket.IO
- ๐ฌ Send Text, Images, and Files
- ๐ผ๏ธ Upload optimized images via ImageKit
- ๐งโ๐คโ๐ง One-to-One chat functionality
- ๐ Fully responsive with DaisyUI components (modals, chat bubbles, alerts, etc.)
- ๐งพ Persistent login using cookie-based auth
- ๐ Socket reconnect handling and session recovery
๐ ๏ธ Tech Stack
๐งฉ Frontend
- React.js
- DaisyUI (built on Tailwind CSS)
- Axios with
withCredentials: true - Socket.IO Client
- React Router DOM
- Zustand
โ๏ธ Backend
- Node.js + Express.js
- MongoDB with Mongoose
- Socket.IO for WebSocket support
- JWT for authentication
- Multer for file uploads
- ImageKit SDK for image CDN/hosting
๐จ UI Design with DaisyUI
Key components:
- ๐ฌ
chat,chat-bubbleโ message UI - ๐ค
modalโ for file/image uploads - ๐
button,input,textareaโ forms and inputs - ๐
themeโ supports dark/light modes - ๐
alert,toastโ feedback components
DaisyUI themes are easy to switch (e.g.
light,dark,cupcake,retro, etc.)
๐ Message Types
| Type | Description |
|---|---|
| Text | Plain messages with emoji support ๐ |
| Image | Uploaded via ImageKit CDN |
| File | Any document (PDF, DOCX, etc.) |
๐ Real-Time Messaging
- Socket connection on login
- Instant message delivery
- Socket disconnects on logout
๐ง Authentication Flow
- Login/Register โ Sets JWT in HTTP-only cookie
- Frontend sends requests with cookies (
withCredentials: true) - Backend Middleware verifies token
- Logout โ clears the cookie and disconnects socket
