- β¨ Features
- π οΈ Tech Stack
- π Project Structure
- β‘ Quick Start
- π API Endpoints
- π Deployment
- π¨βπ» Developer
- β JWT-based user authentication
- β Bcrypt password encryption
- β HTTP-only secure cookies
- β Protected routes & middleware
- β Instant message delivery with Socket.IO
- β Online/Offline user status
- β Message history & persistence
- β Multi-user chat support
- β Modern & responsive design
- β Theme customization support
- β Profile management
- β Image upload via Cloudinary
- β Smooth animations & transitions
chat-app/
βββ backend/
β βββ src/
β β βββ controllers/ # Request handlers
β β βββ models/ # Database schemas
β β βββ routes/ # API routes
β β βββ middleware/ # Auth middleware
β β βββ lib/ # Utilities (DB, Socket, Cloudinary)
β β βββ index.js # Server entry
β βββ package.json
β
βββ frontend/
βββ src/
β βββ components/ # React components
β βββ pages/ # Page components
β βββ store/ # Zustand stores
β βββ lib/ # Utilities
β βββ App.jsx # Root component
βββ package.json
- Node.js v16+ installed
- MongoDB (local or Atlas)
- Cloudinary account
-
Clone the repository
git clone https://github.com/ggauravky/chat-app.git cd chat-app -
Install dependencies
# Install root dependencies npm install # Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
-
Configure environment variables
Create
.envin thebackendfolder:PORT=5001 MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key NODE_ENV=development CLOUDINARY_CLOUD_NAME=your_cloudinary_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
-
Run the application
# Start backend (from backend folder) npm run dev # Start frontend (from frontend folder, new terminal) npm run dev
-
Access the app
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:5001
- Frontend:
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/auth/signup |
Register new user | β |
| POST | /api/auth/login |
User login | β |
| POST | /api/auth/logout |
User logout | β |
| PUT | /api/auth/update-profile |
Update profile | β |
| GET | /api/auth/check |
Check auth status | β |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/messages/users |
Get all users | β |
| GET | /api/messages/:id |
Get messages with user | β |
| POST | /api/messages/send/:id |
Send message | β |
The application is deployed and accessible at:
π https://chat-app-6ly8.onrender.com
- Platform: Render
- Frontend & Backend: Deployed as a monorepo
- Database: MongoDB Atlas
- Image Storage: Cloudinary
Note: The app may take a few seconds to load initially due to Render's free tier cold start.
Gaurav Kumar
This project is licensed under the ISC License.