A modern, full-featured real-time chat application built with React and Firebase, featuring AI-powered chatbots, group messaging, file sharing, and RAG (Retrieval-Augmented Generation) capabilities.
- Real-Time Messaging: Instant messaging with Firebase Firestore for real-time updates
- Group Chats: Create and manage group conversations with public/private visibility
- Direct Messages: One-on-one private messaging between users
- File Sharing: Upload and share files (PDFs, images, documents) via Cloudinary integration
- User Profiles: View and manage user profiles
- Guest Mode: View-only access for 1 hour without authentication
- ExplainBot: Use
@explainto get AI-powered explanations - HelpBot: Use
@helpfor RAG-enhanced assistance with uploaded knowledge base - RAG Integration: Upload documents (PDF, DOCX, PPTX, TXT, CSV) to create group-specific knowledge bases
- Context-Aware Responses: AI bots use uploaded documents to provide relevant answers
- Dark/Light Theme: Toggle between themes
- User Visibility: Control your online/offline status
- Group Invitations: Share group invite links
- Mentions: Tag users in messages with
@username - Responsive Design: Works seamlessly on desktop and mobile devices
- Message Types: Support for text, files, and AI responses
- React 18.3.1 - UI framework
- Vite 5.4.1 - Build tool and dev server
- React Router DOM 7.8.2 - Client-side routing
- Tailwind CSS 3.4.10 - Utility-first CSS framework
- Firebase 10.13.1 - Authentication and Firestore database
- Axios 1.8.4 - HTTP client
- Lucide React - Icon library
- FastAPI - Python web framework
- OpenAI API - GPT models for AI responses
- LangChain 0.1.16 - LLM orchestration
- Pinecone - Vector database for RAG
- Firebase Admin SDK - Server-side Firebase operations
- Uvicorn - ASGI server
- Firebase Authentication - Google OAuth sign-in
- Cloudinary - File storage and CDN
- Firebase Firestore - Real-time database
chat-app/
βββ src/ # Frontend source code
β βββ components/ # React components
β βββ pages/ # Page components
β βββ context/ # React context providers
β βββ config/ # Configuration files
β βββ services/ # Service modules
β βββ Cloudinary/ # File upload utilities
β
βββ fastapi-backend/ # Python backend
β βββ chatbot/ # Chatbot module
β β βββ api/ # API endpoints
β β βββ services/ # Business logic
β β βββ models/ # Data models
β βββ main.py # FastAPI application
β
βββ backend/ # Node.js backend (legacy)
- Node.js 18+ and npm
- Python 3.9+ and pip
- Firebase Account - For authentication and database
- Cloudinary Account - For file storage
- OpenAI API Key - For AI features
- Pinecone Account (optional) - For vector storage
git clone https://github.com/umarfarooq3488/Real-time-chat-app.git
cd chat-app# Install dependencies
npm install
# Create environment file
# Create .env file in root directory with:
VITE_CLOUD_NAME=your_cloudinary_cloud_name
VITE_BOT_API_URL=http://localhost:8000cd fastapi-backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file with:
OPENAI_API_KEY=your_openai_api_key
PINECONE_API_KEY=your_pinecone_api_key
FIREBASE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}- Create a Firebase project at Firebase Console
- Enable Authentication with Google provider
- Create a Firestore database
- Download service account key
- Update
src/config/firebase.jswith your Firebase config
npm run devFrontend will be available at http://localhost:5173
cd fastapi-backend
uvicorn main:app --reload --port 8000Backend API will be available at http://localhost:8000
# Build frontend
npm run build
# The dist/ folder contains the production build- Click "Start Chatting Now" on the welcome page
- Sign in with your Google account via popup
- You'll be redirected to the main chat interface
- Navigate to the chat interface
- Click "Create Group" button
- Set group name, description, and visibility (public/private)
- Share the group invite link with others
- Public Groups: Visible to all users, join directly
- Private Groups: Join via invite link or request access
Type @explain [your question] in any group chat to get AI-powered explanations.
- Upload documents to a group (group creator only)
- Type
@help [your question]in the group chat - The bot will use uploaded documents to provide context-aware answers
- Click the attachment icon in the message input
- Select a file (PDF, images, documents)
- File will be uploaded to Cloudinary and shared in the chat
- Toggle your visibility status to control who can see you online
- Invisible users cannot send messages until they become visible
POST /chat- Send message to AI bot (@explainor@help)POST /rag- RAG-based chat endpoint
POST /rag/knowledge-base/upload?group_id={groupId}- Upload document for knowledge baseGET /rag/knowledge-base/info?group_id={groupId}- Get knowledge base informationDELETE /rag/knowledge-base/clear?group_id={groupId}- Clear knowledge basePOST /rag/knowledge-base/search?group_id={groupId}- Search knowledge base
GET /health- API health statusGET /- API information
- Connect your GitHub repository to Netlify
- Set build command:
npm run build - Set publish directory:
dist - Add environment variables:
VITE_CLOUD_NAMEVITE_BOT_API_URL
- Connect your GitHub repository
- Set Python as runtime
- Add environment variables:
OPENAI_API_KEYPINECONE_API_KEYFIREBASE_SERVICE_ACCOUNT_JSONPORT(auto-set by platform)
VITE_CLOUD_NAME=your_cloudinary_cloud_name
VITE_BOT_API_URL=https://your-backend-url.comOPENAI_API_KEY=sk-...
PINECONE_API_KEY=...
FIREBASE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}
PINECONE_INDEX_NAME=knowledge-baseA test HTML file is included: test-upload.html
- Open
test-upload.htmlin a browser - Enter your API URL and group ID
- Select a file and upload
- Verify the upload in the console
The application supports RAG for context-aware AI responses:
- Document Upload: Group creators can upload documents (PDF, DOCX, PPTX, TXT, CSV)
- Vector Storage: Documents are chunked and stored in Pinecone vector database
- Semantic Search: When users ask questions with
@help, the system:- Searches the knowledge base for relevant chunks
- Uses retrieved context to generate accurate responses
- Maintains conversation history per group
- Files are uploaded to Cloudinary
- Supports multiple file types (images, PDFs, documents)
- Files are displayed inline in chat
- PDFs can be viewed directly in the browser
- Public Groups: Anyone can join and view
- Private Groups: Requires invitation or approval
- Group Invitations: Shareable invite links
- Group Roles: Creator and member roles
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Umar Farooq
- GitHub: @umarfarooq3488
- Firebase for authentication and real-time database
- OpenAI for AI capabilities
- Cloudinary for file storage
- Pinecone for vector database
- All open-source contributors
For support, open an issue in the GitHub repository.
- v1.0.0 - Initial release with core features
- Real-time messaging
- Group and direct messaging
- AI bot integration
- File sharing
- RAG capabilities
Made with β€οΈ using React, Firebase, and FastAPI