A real-time chat application built using the MERN stack (MongoDB, Express, React, Node.js) with automatic message translation based on the recipient's language preference. Break language barriers and chat seamlessly with anyone around the world!
📌 Click the link to view the demo: Watch the demo on YouTube
- 🔥 Real-time messaging using Socket.io
- 🌐 Automatic language translation of incoming messages
- 🗣️ User-specific language selection
- 🛡️ Secure authentication using JWT
- 🖥️ Responsive and clean React.js frontend
- ⚡ Scalable backend built with Express.js and MongoDB
-
Clone the repository
git clone https://github.com/Aahil56/Real-Time-MERN-Translation-Chat-Application.git cd Real-Time-MERN-Translation-Chat-Application -
Setup Backend
cd server npm installCreate a
.envfile inside the server directory:PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key TRANSLATION_API_KEY=your_translation_api_key TRANSLATION_API_URL=your_translation_api_url
Start the backend server:
npm run dev
-
Setup Frontend
cd client npm installCreate a
.envfile inside the client directory:REACT_APP_SOCKET_SERVER_URL=http://localhost:5000 REACT_APP_TRANSLATION_API_URL=your_translation_api_url REACT_APP_TRANSLATION_API_KEY=your_translation_api_key
Start the frontend app:
npm start
- Users register or log in using email and password.
- Upon login, a JWT token is generated and used for authentication.
- Users select their preferred language from a list (e.g., English, Spanish, French).
- When a user sends a message, it is first captured by the backend server.
- The backend automatically translates the message into the recipient's selected language using a Translation API.
- The translated message is immediately emitted through Socket.io to the recipient in real-time.
- The recipient's chatbox shows the translated message without delay.
- Frontend: React.js, Axios, Socket.io-client
- Backend: Node.js, Express.js, Socket.io
- Database: MongoDB (Mongoose)
- Authentication: JWT (JSON Web Tokens)
- Translation API: (Google Translate API / LibreTranslate / etc.)
- Real-time Communication: WebSockets via Socket.io
├── client/ # React frontend
│ ├── public/
│ └── src/
│ ├── components/
│ ├── pages/
│ ├── services/
│ └── App.js
├── server/ # Node.js + Express backend
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ └── server.js
├── package.json
└── README.md
