A real-time chat application with π authentication, π’ online user tracking (Socket.IO), and πΌοΈ profile picture upload (Cloudinary).
- LIVE Website: https://your-deployed-site-url.com
- π Cookie-based JWT authentication
- π¬ Real-time messaging with Socket.IO
- π’ Online users tracking
- πΌοΈ Profile picture upload via Cloudinary
- π¨ Modern UI (React + Tailwind)
Backend/β Express + MongoDB + Socket.IO serverFrontend/vite-project/β React (Vite) client
- Backend: Node.js, Express, MongoDB (Mongoose), JWT (cookie-based), Socket.IO
- Frontend: React, Vite, Zustand, Axios, Tailwind CSS
- Media: Cloudinary (images are stored in Cloudinary, DB stores the image URL)
- Node.js installed
- MongoDB connection string (Atlas or local)
- Cloudinary account (for profile picture upload)
Install dependencies:
cd Backend
npm installCreate Backend/.env (copy from Backend/.env.example and fill your real values). Do NOT commit Backend/.env.
PORT=5000
NODE_ENV=development
MONGODB_URI=your_mongodb_connection_string
secretKey=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_SECRET_KEY=your_api_secretStart the backend:
npm startBackend entry: Backend/src/app.js
Important:
- Frontend API base URL is
http://localhost:5000/api(seeFrontend/vite-project/src/lib/axios.js). - Socket.IO client connects to
http://localhost:5000(seeFrontend/vite-project/src/store/authStore.js). - Keep
PORT=5000locally unless you also update those client URLs.
Install dependencies:
cd Frontend/vite-project
npm installStart the frontend:
npm run devVite typically runs at http://localhost:5173.
Note:
- Running
npm startinsideFrontend/(notFrontend/vite-project/) will fail becauseFrontend/has nopackage.json.
- The user document stores
profilepicas a string URL. - Frontend sends a Base64 DataURL to
POST /api/auth/update-profile. - Backend uploads to Cloudinary and saves
secure_urlin MongoDB. - If no image is set, the frontend uses a generated fallback avatar.
You can deploy Backend and Frontend separately.
- Deploy
Backend/to a Node hosting provider (Render / Railway / etc.). - Set the same environment variables from
Backend/.envin your hosting dashboard. - Ensure your backend CORS allows your deployed frontend domain.
- Deploy
Frontend/vite-project/to a static host (Vercel / Netlify / etc.). - Update the frontend to point to your deployed backend:
- API base URL in
Frontend/vite-project/src/lib/axios.js - Socket server URL in
Frontend/vite-project/src/store/authStore.js
- API base URL in
- After deploying, paste your deployed URL into the Live Website section above so people can click it.
- Profile upload fails: verify Cloudinary env vars.
- CORS errors: make sure backend allows your frontend domain.
- Socket not connecting: confirm the client is pointing to the correct socket URL.