A secure, memory-augmented Generative AI Chatbot powered by Google Gemini Pro using LangChain, with full user login/registration backed by XAMPP-based MySQL database. The chatbot remembers conversations using LangChain’s ConversationBufferMemory, enabling contextual follow-up questions.
✅ Gemini-Pro API integration via LangChain
✅ Secure login & registration with MySQL (via XAMPP/phpMyAdmin)
✅ Per-user conversation memory (LangChain's ConversationBufferMemory)
✅ Fully interactive chatbot built with Streamlit
✅ Modular codebase for easy extension
✅ Environment-variable based secret management (.env)
✅ Extendable for LangGraph or multi-agent agentic workflows
| Layer | Technology |
|---|---|
| 💬 LLM | Gemini-2.5-Pro via LangChain |
| 🧠 Memory | LangChain ConversationBufferMemory |
| 🌐 UI | Streamlit |
| 🔐 Auth | MySQL (XAMPP) + SHA256 hashing |
| 🔌 Backend | Python + LangChain + mysql-connector-python |
chatbot/
├── app.py # Main Streamlit App
├── db.py # MySQL login/register functions
├── langchain_gemini.py # LLM + memory integration
├── .env # Secure Gemini API key
├── requirements.txt # Python dependenciesgit clone https://github.com/your-username/Chatbot-with-User-Login.git
cd Chatbot-with-User-Loginpip install -r requirements.txtCreate a .env file:
GEMINI_API_KEY=your_actual_gemini_api_key- Launch XAMPP → Start Apache & MySQL
- Visit: http://localhost/phpmyadmin
- Run SQL:
CREATE DATABASE chatbot;
USE chatbot;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE,
password VARCHAR(255)
);streamlit run app.py- User registers/login via MySQL database.
- On successful login, a personalized LangChain memory session starts.
- Gemini LLM answers the user queries with context.
- Chat memory persists for the session (can be extended for long-term storage).
- User can logout anytime.
- Passwords are hashed with SHA256 (upgradeable to bcrypt/argon2).
- Gemini API key is stored in
.envfile (never commit this). - No chat history is stored in database (unless you extend memory to MySQL).
| Feature | Status |
|---|---|
| LangGraph orchestration | 🔜 Planned |
| Multi-agent Planner-Executor | 🔜 Planned |
| Chat history storage (MySQL) | 🔜 Optional |
| Admin dashboard | 🔜 Optional |
| Tool-augmented answers (PDF/API) | 🔜 Future |
| Multi-user chat insights | 🔜 Future |
Pull requests, feature suggestions, and feedback are welcome!
👤 Developed by: Md Emon Hasan 📧 Email: iconicemon01@gmail.com 💬 WhatsApp: +8801834363533 💻 GitHub: Md-Emon-Hasan