A full-stack AI chatbot application built using Next.js 16, MongoDB, and Google Gemini API.
It provides real-time AI conversations with voice support, persistent chat history, and modern UI.
- 💬 Real-time chat interface
- 🧠 AI-powered responses (Gemini 2.5 Flash)
- 💾 Persistent chat history (MongoDB)
- 🎤 Speech-to-Text (Voice input)
- 🔊 Text-to-Speech (AI speaks replies)
- ⚡ Typing animation effect
- 🧹 Clear chat functionality
- 📝 Markdown rendering (formatted AI responses)
- 🎨 Clean, responsive UI (Dark theme)
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React, Tailwind CSS |
| Backend | Next.js API Routes |
| Database | MongoDB + Mongoose |
| AI Engine | Google Gemini API |
| Language | TypeScript |
ai-chatbot/
│── app/
│ ├── api/
│ │ ├── chat/ # AI response API
│ │ ├── history/ # Fetch chat history
│ │ └── clear/ # Clear chat endpoint
│ ├── page.tsx
│
│── components/
│ └── ChatBox.tsx # Main UI + Voice + Markdown
│
│── lib/
│ └── mongodb.ts # DB connection
│
│── models/
│ └── Chat.ts # Chat schema
│
│── .env.local
│── package.json
git clone https://github.com/Divyansh11x/ai-chatbot.git
cd ai-chatbotnpm installCreate .env.local file:
MONGODB_URI=your_mongodb_connection_string
GEMINI_API_KEY=your_gemini_api_keynpm run devOpen in browser:
http://localhost:3000
- Check
MONGODB_URI - Ensure Network Access = Allow all (0.0.0.0/0) in MongoDB Atlas
- Add environment variables in Vercel → Settings → Environment Variables
- Works best in Chrome browser
- Requires HTTPS (on deployment)
- 🔐 User Authentication (Google login)
- 🧠 Chat sessions (like ChatGPT)
- 📊 Analytics dashboard
- 🌐 Multi-language support
- ⚡ Streaming responses
- 📱 Mobile UI optimization
- Full-stack development with Next.js App Router
- API design & integration
- MongoDB data persistence
- AI API integration (Gemini)
- Voice APIs (Web Speech API)
- Markdown rendering in React
Divyansh
🔗 GitHub: https://github.com/Divyansh11x
This project is licensed under the MIT License. You are free to use, modify, and distribute this software with attribution.
⭐ If you found this project useful, consider giving it a star — it helps others discover it.
🚧 Actively improving → New features coming soon