Flipho Chat Room is a full-stack real-time chat application built with the MERN stack. It offers a premium, WhatsApp-inspired Dark Mode experience with AI-powered chat assistance, allowing users to chat one-on-one, in groups, or with an AI assistant. Features include encrypted messaging, image sharing, emoji support, and seamless real-time communication.
- Intelligent AI Assistant: Chat with an AI assistant powered by OpenAI GPT-4o-mini
- Context-Aware Responses: AI maintains conversation context for natural, helpful interactions
- Automatic Responses: AI responds automatically when you send messages
- Quality Conversations: Detailed, thoughtful responses that adapt to question complexity
- Token Usage Tracking: Monitor AI usage and costs via
/api/ai/usageendpoint
- Premium Aesthetic: Completely redesigned UI featuring deep black/green backgrounds (
#0b141a) and teal accents (#00a884) - Eye-Friendly Design: High-contrast text and solid colors for better readability and reduced eye strain
- Modern Interface: Clean, minimalist design inspired by WhatsApp's dark mode
- One-on-One Chats: Private, encrypted conversations between two users
- Group Chats: Create groups, name them, add/remove members, and manage admins
- Real-Time Communication: Instant message delivery using Socket.io
- Message Persistence: All messages are saved and persist across sessions
- Message Reactions: React to messages with emojis
- Image Uploads: Share images directly within the chat
- Emoji Picker: Built-in emoji picker for expressive communication
- File Attachments: Support for various file types
- Live Notifications: Instant alerts when you receive messages
- Typing Indicators: See when someone is typing a response
- Read Receipts: Track message read status
- Online Status: See who's online in real-time
- Socket.io Integration: Seamless real-time updates without page refreshes
- End-to-End Encryption: Messages encrypted using AES encryption
- JWT Authentication: Secure token-based authentication
- Password Hashing: Bcrypt password encryption
- Access Control: Users can only access their own chats
- Search Users: Find friends by name or email
- Profile Management: View and manage user profiles
- User Avatars: Custom profile pictures
- Group Administration: Group owners and admins can manage members
| Layer | Technology |
|---|---|
| Frontend | ReactJS, Chakra UI, Framer Motion, Axios, React Lottie |
| Backend | Node.js, Express.js, Multer (file uploads) |
| Database | MongoDB, Mongoose |
| Real-Time | Socket.io |
| Authentication | JWT, bcryptjs |
| AI Integration | OpenAI API (GPT-4o-mini), OpenAI SDK |
| Encryption | CryptoJS (AES encryption) |
| Deployment | Docker, Docker Compose |
- Node.js (v14 or higher) installed
- MongoDB installed locally or MongoDB Atlas account
- OpenAI API key (for AI features)
- Docker & Docker Compose (optional, for containerized deployment)
-
Clone the repository
git clone https://github.com/gaurav147-star/Flipho_Chat_Room.git cd Flipho_Chat_Room -
Create
.envfile in the root directory:PORT=5000 MONGO_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret SECRET_KEY=your_message_encryption_key OPENAI_API_KEY=your_openai_api_key OPENAI_MODEL=gpt-4o-mini NODE_ENV=production
-
Start with Docker Compose
docker-compose up -d --build
The application will be available at:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:5000 - MongoDB:
mongodb://localhost:27017
- Frontend:
-
Clone the repository
git clone https://github.com/gaurav147-star/Flipho_Chat_Room.git cd Flipho_Chat_Room -
Install Dependencies
# Install root dependencies npm install # Install frontend dependencies cd frontend && npm install # Install backend dependencies cd ../backend && npm install
-
Environment Setup Create a
.envfile in the root directory:PORT=5000 MONGO_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret SECRET_KEY=your_message_encryption_key OPENAI_API_KEY=your_openai_api_key OPENAI_MODEL=gpt-4o-mini
-
Run the Application
# From root directory - starts backend npm start # In a separate terminal - start frontend cd frontend npm start
The app should now be running at
http://localhost:3000!
Long messages from other users are automatically truncated with a "Read more" button. Click to expand and see the full message, keeping the chat interface clean and organized.
Chat list showing AI Assistant and other conversations
Example of a detailed AI conversation with context-aware responses
Search functionality to find and connect with other users
POST /api/user/login- User loginPOST /api/user/register- User registrationGET /api/user- Get user profilePUT /api/user- Update user profile
GET /api/chat- Get all chats for user (includes AI chat)POST /api/chat- Create or access one-on-one chatPOST /api/chat/group- Create group chatPUT /api/chat/rename- Rename group chatPUT /api/chat/groupadd- Add user to groupPUT /api/chat/groupremove- Remove user from group
GET /api/message/:chatId- Get all messages for a chatPOST /api/message- Send a messagePUT /api/message/reaction- React to a message
GET /api/ai/usage- Get AI token usage statistics
| Variable | Description | Required |
|---|---|---|
PORT |
Backend server port | Yes |
MONGO_URI |
MongoDB connection string | Yes |
JWT_SECRET |
Secret key for JWT tokens | Yes |
SECRET_KEY |
Key for message encryption | Yes |
OPENAI_API_KEY |
OpenAI API key for AI features | Yes (for AI) |
OPENAI_MODEL |
OpenAI model to use (default: gpt-4o-mini) | No |
The application includes:
Dockerfile- Backend container configurationfrontend/Dockerfile- Frontend container configurationdocker-compose.yml- Multi-container orchestrationfrontend/nginx.conf- Nginx configuration for frontend
- Automatic Chat Creation: Every user automatically gets an AI chat
- Context Preservation: AI remembers last 15 messages for context
- Smart Responses: Adapts response length based on question complexity
- Error Handling: Graceful handling of API errors and rate limits
- Usage Tracking: Monitor token usage per user/chat
- Encryption: All messages encrypted with AES before storage
- Chronological Ordering: Messages sorted by creation time
- Image Support: Upload and share images
- Reactions: React to messages with emojis
- Read Receipts: Track who has read messages
- Group Creation: Create groups with custom names
- Admin Management: Assign group admins
- Member Management: Add/remove members (admins only)
- Group Settings: Rename groups, update group pictures
-
AI not responding
- Check if
OPENAI_API_KEYis set correctly - Verify API key has sufficient credits
- Check backend logs for errors
- Check if
-
Messages not showing
- Ensure MongoDB is running and connected
- Check
SECRET_KEYis set correctly - Verify user has access to the chat
-
Socket.io connection issues
- Check CORS settings in
server.js - Verify Socket.io server is running
- Check browser console for connection errors
- Check CORS settings in
-
Docker issues
- Ensure Docker Desktop is running
- Check container logs:
docker-compose logs - Verify
.envfile is in root directory
Made with β€οΈ by Gaurav

