A premium AI-powered chat application built with a modern tech stack, featuring secure authentication, real-time session tracking, and multimodal voice capabilities.
- Advanced Authentication: Secure login/signup system using JWT Access & Refresh Tokens.
- Real-time Session Tracking: A live countdown timer in the navbar keeps you informed of your remaining session time.
- Silent Token Refresh: Automatic session renewal in the background via Axios interceptors.
- Voice Chat: Transcribe and process audio messages using Gemini 1.5 Flash's multimodal capabilities.
- Streaming Responses: Real-time AI response generation using Server-Sent Events (SSE).
- Markdown Support: Rich text rendering for AI responses including code blocks, tables, and lists.
- Multi-Chat Management: Create, list, rename, and delete conversation threads easily.
- Modern UI/UX: Built with Material UI (MUI) following premium design principles.
- React 19 with TypeScript
- Vite for lightning-fast builds
- Material UI (MUI) v7 for styling
- React Router Dom v7 for navigation
- React Hook Form + Zod for form validation
- Axios with custom interceptors
- Node.js & Express with TypeScript
- MongoDB with Mongoose
- Google Generative AI SDK (Gemini 1.5 Flash)
- JSON Web Tokens (JWT) for secure sessions
- Multer for audio processing
- Node.js (v18 or higher)
- MongoDB (Local or Atlas)
- Gemini API Key
git clone https://github.com/ssarthak75way/ChatBot.git
cd CHATBOTNavigate to the backend directory and install dependencies:
cd backend
npm installCreate a .env file in the backend folder:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_base_secret
JWT_ACCESS_SECRET=your_access_token_secret
JWT_REFRESH_SECRET=your_refresh_token_secret
GEMINI_API_KEY=your_google_gemini_api_keyNavigate to the frontend directory and install dependencies:
cd ../frontend
npm installCreate a .env file in the frontend folder:
VITE_API_BASE_URL=http://localhost:5000/apiStart Backend:
cd backend
npm run devStart Frontend:
cd frontend
npm run dev- Access Tokens: Short-lived (default 30 min) for security.
- Refresh Tokens: Long-lived (default 7 days) stored in the database for session persistence.
- Auto-Logout: The application automatically clears local storage and redirects to login when the session definitively expires.
Click the Microphone icon in the chat input to start recording. Stop the recording to automatically send the audio. The system will transcribe your speech and generate a relevant AI response.
This project is licensed under the MIT License.