Skip to content

Avinash-sdbegin/Chatify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸ’¬ Chatify (MERN + Socket.IO)

πŸ” Authentication β€’ πŸ’¬ Real-time messaging β€’ 🟒 Online users β€’ πŸ–ΌοΈ Cloudinary uploads
Chatify is a full-stack real-time chat app built with Node.js, Express, MongoDB, React (Vite), and Socket.IO.

Live Frontend Live Backend Node MongoDB Socket Cloudinary

--- ## 🌐 Live Website - **Frontend (Vercel):** https://chatify-plum.vercel.app/ - **Backend (Render):** https://chatify-backend-4qij.onrender.com/ --- πŸš€ A production-ready real-time chat app with a scalable MERN backend and low-latency Socket.IO messaging. ## ✨ Features - πŸ” Cookie-based JWT authentication (signup/login/logout) - πŸ’¬ Real-time chat with Socket.IO - 🟒 Online user tracking - πŸ–ΌοΈ Profile picture upload via Cloudinary - 🎨 Modern UI (React + Tailwind) with Zustand state management --- ## 🧰 Tech Stack - **Backend:** Node.js, Express, MongoDB (Mongoose), JWT (cookie-based), Socket.IO - **Frontend:** React, Vite, Zustand, Axios, Tailwind CSS, Socket.IO Client - **Media:** Cloudinary (uploads stored in Cloudinary, DB stores image URL) --- ## πŸ“ Project Structure ```text LIVE_CHAT/ β”œβ”€β”€ Readme.md β”œβ”€β”€ Home.png β”œβ”€β”€ Login.png β”œβ”€β”€ Backend/ # Express + MongoDB + Socket.IO β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ app.js # Express app + socket bootstrap β”‚ β”‚ β”œβ”€β”€ controllers/ β”‚ β”‚ β”‚ β”œβ”€β”€ authController.js β”‚ β”‚ β”‚ └── messageController.js β”‚ β”‚ β”œβ”€β”€ routes/ β”‚ β”‚ β”‚ β”œβ”€β”€ authRoute.js β”‚ β”‚ β”‚ └── messageRoute.js β”‚ β”‚ β”œβ”€β”€ middlewares/ β”‚ β”‚ β”‚ └── authMiddleware.js β”‚ β”‚ β”œβ”€β”€ model/ β”‚ β”‚ β”‚ β”œβ”€β”€ userModel.js β”‚ β”‚ β”‚ └── messageModel.js β”‚ β”‚ └── lib/ β”‚ β”‚ β”œβ”€β”€ cloudinary.js β”‚ β”‚ β”œβ”€β”€ socket.js β”‚ β”‚ └── token.js β”‚ β”œβ”€β”€ package.json β”‚ └── .env.example └── Frontend/ └── vite-project/ # React (Vite) client β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ Pages/ β”‚ β”‚ β”œβ”€β”€ HomePage.jsx β”‚ β”‚ β”œβ”€β”€ LoginPage.jsx β”‚ β”‚ β”œβ”€β”€ ProfilePage.jsx β”‚ β”‚ └── SignUpPage.jsx β”‚ β”œβ”€β”€ components/ β”‚ β”‚ β”œβ”€β”€ ChatContainer.jsx β”‚ β”‚ β”œβ”€β”€ ChatHeader.jsx β”‚ β”‚ β”œβ”€β”€ MessageInput.jsx β”‚ β”‚ β”œβ”€β”€ Messages.jsx β”‚ β”‚ β”œβ”€β”€ Navbar.jsx β”‚ β”‚ β”œβ”€β”€ NoChatSelected.jsx β”‚ β”‚ β”œβ”€β”€ Sidebar.jsx β”‚ β”‚ └── UserChatHeader.jsx β”‚ β”œβ”€β”€ store/ β”‚ β”‚ β”œβ”€β”€ authStore.js β”‚ β”‚ └── chatStore.js β”‚ β”œβ”€β”€ lib/ β”‚ β”‚ β”œβ”€β”€ axios.js β”‚ β”‚ └── utils.js β”‚ β”œβ”€β”€ App.jsx β”‚ └── main.jsx β”œβ”€β”€ public/ β”œβ”€β”€ vite.config.js └── package.json ``` --- ## πŸ“Έ Preview ### 🏠 Home / Chat ![Home](./Home.png) ### πŸ” Login ![Login](./Login.png) --- ## πŸš€ Getting Started (Local) ## βœ… Prerequisites - Node.js installed - MongoDB connection string (Atlas or local) - Cloudinary account ### 1) Backend Setup ```bash cd Backend npm install ``` Create `Backend/.env` (copy from `Backend/.env.example`): ```bash copy .env.example .env ``` Start backend: ```bash npm start ``` ### 2) Frontend Setup ```bash cd Frontend/vite-project npm install ``` Create `Frontend/vite-project/.env` (copy from `.env.example`): ```bash copy .env.example .env ``` Start frontend: ```bash npm run dev ``` --- ## πŸ”‘ Environment Variables ### Backend (`Backend/.env`) | Variable | Required | Description | | --- | --- | --- | | `PORT` | ❌ | Server port | | `MONGODB_URI` | βœ… | MongoDB connection string | | `secretKey` | βœ… | JWT secret used to sign cookies | | `CLIENT_URL` | ❌ | Frontend URL allowed by CORS (Vercel domain) | | `CLOUDINARY_CLOUD_NAME` | βœ… | Cloudinary cloud name | | `CLOUDINARY_API_KEY` | βœ… | Cloudinary API key | | `CLOUDINARY_SECRET_KEY` | βœ… | Cloudinary API secret | ### Frontend (`Frontend/vite-project/.env`) | Variable | Required | Description | | --- | --- | --- | | `VITE_API_BASE_URL` | βœ… | Backend API base URL (e.g. `http://localhost:5000/api`) | | `VITE_SOCKET_URL` | βœ… | Backend socket URL (e.g. `http://localhost:5000`) | --- ## 🚒 Deployment ### Backend (Render) 1. Deploy `Backend/` as a Node service. 2. Set env vars from `Backend/.env` in Render dashboard. 3. Set `CLIENT_URL` = your Vercel frontend domain. ### Frontend (Vercel) 1. Deploy `Frontend/vite-project/`. 2. Set `VITE_API_BASE_URL` and `VITE_SOCKET_URL` to your deployed Render backend URLs. --- ## ⚑ Challenges Faced - Fixed CORS issues during deployment - Managed socket connections across environments - Handled cookie-based authentication in production ## 🧩 Common Issues - **CORS errors:** make sure backend `CLIENT_URL` matches your deployed frontend domain. - **Socket not connecting:** ensure `VITE_SOCKET_URL` points to backend. - **Uploads failing:** verify Cloudinary env vars. --- ## πŸ‘¨β€πŸ’» Author Built by Avinash.

About

πŸš€ Chatify – A Real-Time MERN Chat App with Live Messaging, Auth & Profile Uploads

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages