A modern full-stack real-time chat application built with React, Node.js, Express, MongoDB, and Socket.IO.
Chat Pro is a scalable real-time messaging platform that demonstrates modern full-stack development practices. It includes authentication, real-time communication, chat rooms, private messaging, file sharing, and a responsive user interface.
Whether you're learning how real-time applications work or looking for a solid project architecture, Chat Pro provides a practical and production-oriented foundation.
- Secure user registration and login
- JWT-based authentication
- Password hashing with Bcrypt
- User profile management
- Online user presence
- Instant messaging powered by Socket.IO
- Live message updates without page refresh
- Chat history persistence
- Typing indicators
- Online/offline status
- Create and join chat rooms
- Leave rooms
- Group conversations
- View room members
- Direct messaging
- Private chat history
- Secure communication between users
- Image uploads
- File uploads
- Image preview inside chat
- File downloads
- Responsive design
- Mobile-friendly
- Desktop optimized
- Built with React
- Styled using Tailwind CSS
- React
- React Router
- Axios
- Socket.IO Client
- Tailwind CSS
- Node.js
- Express.js
- MongoDB
- Mongoose
- Socket.IO
- JWT
- Bcrypt
- Multer
- Docker
- Docker Compose
- Nginx
chat-pro/
βββ backend/
β βββ src/
β β βββ config/
β β βββ controllers/
β β βββ middleware/
β β βββ models/
β β βββ routes/
β β βββ socket/
β β βββ server.js
β βββ uploads/
β βββ .env
β βββ package.json
β
βββ frontend/
β βββ src/
β β βββ components/
β β βββ pages/
β β βββ services/
β β βββ App.jsx
β β βββ main.jsx
β βββ .env
β βββ package.json
β
βββ docker-compose.yml
βββ .env.example
βββ .gitignore
βββ README.md
Make sure you have installed:
- Node.js
- npm
- MongoDB
- Git
Or simply use Docker.
git clone https://github.com/khodemadi/chat-pro2.git
cd chat-procd backend
npm installCreate a .env file.
PORT=5000
MONGODB_URI=mongodb://localhost:27017/chat-pro
JWT_SECRET=your-super-secret-key
JWT_EXPIRES_IN=15m
REFRESH_TOKEN_SECRET=your-refresh-secret-key
CLIENT_URL=http://localhost:5173Start the backend server.
npm run devBackend runs on:
http://localhost:5000
Open another terminal.
cd frontend
npm install
npm run devFrontend runs on:
http://localhost:5173
Build and start all services:
docker compose up --buildRun in detached mode:
docker compose up -d --buildStop services:
docker compose downThe application uses JWT for secure authentication.
User
β
βΌ
Login
β
βΌ
Backend
β
βΌ
Validate Credentials
β
βΌ
Generate JWT
β
βΌ
Return Token
β
βΌ
Frontend
POST /api/auth/register
POST /api/auth/login
POST /api/auth/refresh
POST /api/auth/logoutSocket.IO enables low-latency communication between connected users.
User A
β
β Send Message
βΌ
Socket.IO Server
β
ββββββββββββββΊ MongoDB
β
βΌ
User B
join-room
leave-room
send-message
receive-message
typing
stop-typing
user-online
user-offline
username
email
password
avatar
status
createdAt
name
description
owner
members
createdAt
sender
receiver
room
text
file
createdAt
Uploads are handled with Multer.
Supported file types include:
.jpg
.png
.gif
.pdf
.zip
.docx
For production deployments, cloud storage solutions such as AWS S3 or Cloudinary are recommended.
For production environments, consider implementing:
- HTTPS
- Secure environment variables
- Input validation
- Password hashing
- Rate limiting
- Proper CORS configuration
- Helmet middleware
- Upload size limits
- File type validation
- Secure Refresh Tokens
Optimized for:
- π± Mobile
- π Tablet
- π» Laptop
- π₯ Desktop
Future improvements include:
- Voice calls
- Video calls (WebRTC)
- Voice messages
- Message reactions
- Reply to messages
- Edit messages
- Delete messages
- Search messages
- Push notifications
- Dark mode
- End-to-End Encryption
- User blocking and reporting
- Admin dashboard
- Roles & permissions
Contributions are welcome!
-
Fork the repository.
-
Create a feature branch.
git checkout -b feature/amazing-feature- Commit your changes.
git commit -m "Add amazing feature"- Push your branch.
git push origin feature/amazing-feature- Open a Pull Request.
This project is licensed under the MIT License.
See the LICENSE file for more information.
Developed with β€οΈ using modern JavaScript technologies to explore scalable real-time application architecture.
If you found this project useful:
- β Star the repository
- π΄ Fork it
- π Contribute improvements
- π’ Share it with others
Your support helps the project grow.