A modern, real-time, full-stack chat application equipped with text/file messaging, WebRTC audio/video calls, and email OTP verification.
🚀 Live Site: https://chatappliction-i23b.onrender.com
🖥️ Backend API: https://chatappliction-m73z.onrender.com
- Instant Delivery: Message broadcasting powered by Socket.IO.
- Rich Media Support: Send text, images, and attachments (up to 5MB).
- Threads & Replies: Reply directly to specific messages.
- Mentions & Mentions Tracking: Mention users in a room with
@username. - Typing Indicators: Real-time feedback when other users are typing.
- User Status: Live online/offline status indicators and last seen timestamps.
- Peer-to-peer direct audio/video calling.
- Group call capabilities for up to 15 participants in a chat room.
- Socket.IO-based signaling server for WebRTC handshake configuration.
- Local Auth: Traditional sign-up and login using email/password.
- OTP Verification: Registration email verification using secure, timed OTPs sent via SMTP.
- Password Recovery: Forgotten password resets authenticated by email OTP verification.
- OAuth 2.0: One-click registration/login with Google OAuth (via Passport.js).
- Upload and customize user avatar pictures.
- Real-time avatar updates propagated instantly to active chats.
- Framework: React.js (Vite)
- Styling: Tailwind CSS, PostCSS
- Routing: React Router DOM
- State & Networking: Axios, React Context API
- WebSockets: Socket.io-client
- P2P Connection: WebRTC API (STUN servers)
- Runtime: Node.js (Express)
- Database: MongoDB (using Mongoose ODM)
- Authentication: Passport.js (Google Strategy), JSON Web Tokens (JWT), Bcrypt.js
- Real-time Engine: Socket.IO
- Email Transporter: Nodemailer
├── client/ # Frontend Vite + React application
│ ├── dist/ # Production build outputs
│ ├── public/ # Static assets (favicons, etc.)
│ ├── src/
│ │ ├── asset/ # SVGs, images, logos
│ │ ├── components/ # Reusable React components
│ │ │ ├── call/ # WebRTC Call modals and widgets
│ │ │ ├── chat/ # Chat window, sidebar, message bubble
│ │ │ ├── common/ # Common UI components (e.g. Avatar)
│ │ │ └── profile/ # User profile customization modal
│ │ ├── context/ # React Auth and Socket contexts
│ │ ├── hooks/ # Custom React hooks (WebRTC hook)
│ │ ├── pages/ # Application pages (Chat, Login, Verify, etc.)
│ │ ├── utils/ # Axios instance and API configuration
│ │ ├── App.jsx # React Routes and app assembly
│ │ ├── index.css # Global CSS and Tailwind directives
│ │ └── main.jsx # React entrypoint
│ ├── package.json
│ ├── tailwind.config.js # Tailwind UI design configuration
│ └── vite.config.js # Vite configuration and local Proxy settings
│
├── server/ # Backend Node.js Express server
│ ├── config/ # Mongoose Database & Passport OAuth setups
│ ├── controllers/ # Core business logic handlers (Auth, Messages, Rooms)
│ ├── middleware/ # Route protections and custom middleware
│ ├── models/ # Mongoose schemas (User, Message, Room)
│ ├── routes/ # Express API endpoints
│ ├── socket/ # Socket.IO connection and event handler
│ ├── utils/ # Mailer transporter, OTP, and validation helpers
│ ├── .env # Local environment secrets (ignored by Git)
│ ├── index.js # App server entrypoint
│ └── package.json
│
└── README.md
Create a .env file inside the server/ directory and configure the following variables:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
SESSION_SECRET=your_express_session_secret
# URLs (Local Development defaults)
CLIENT_URL=http://localhost:5173
SERVER_URL=http://localhost:5000
# Google OAuth Credentials
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callback
# SMTP Mail Server Settings (Nodemailer)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your_email_address
SMTP_PASS=your_email_app_password
EMAIL_FROM=your_email_addressFor local development, Vite uses the proxy configured in vite.config.js to route /api requests to the local server (http://localhost:5000).
For production deployments, the frontend requires the backend URL. You can set the backend API domain using:
VITE_API_ORIGIN=https://chatappliction-m73z.onrender.com
Note: The frontend code falls back to https://chatappliction-m73z.onrender.com automatically in production environments if this variable is not explicitly specified.
git clone <repository_url>
cd chatappcd server
npm install
# Configure your .env file here
npm run devcd ../client
npm install
npm run devOpen your browser to http://localhost:5173.
- Repository root: Deploy the
server/subfolder. - Build Command:
npm install - Start Command:
node index.js - Set up the environment variables in the Render console as described in the configuration section above. Keep
NODE_ENVasproduction.
- Repository root: Deploy the
client/subfolder. - Build Command:
npm run build - Publish directory:
dist - Environment Variables: Set
VITE_API_ORIGINto your backend URL (https://chatappliction-m73z.onrender.com). - Rewrites/Redirects Configuration (SPA routing support):
To support client-side routing and prevent
404 Not Founderrors on direct page refreshes or OAuth redirects, add the following rewrite rule in Render:- Source:
/* - Destination:
/index.html - Action:
Rewrite
- Source: