A fully functional AI chatbot built from scratch using HTML, CSS & JavaScript — powered by xAI's Grok and deployed on Vercel.
🔗 Click here to try the live chatbot →
This is a minor academic project developed as part of the BTech 2nd Year curriculum at Maulana Azad NAtional Institute of Technology Bhopal.
The chatbot is designed to assist college students and staff by answering academic queries related to:
- Attendance rules and policies
- Exam schedules and guidelines
- CGPA and grading system
- College rules and regulations
- General academic FAQs
The bot is powered by Grok-3-mini from xAI, accessed securely through a serverless Vercel function so the API key is never exposed on the frontend.
| Feature | Description |
|---|---|
| ⌨️ Typing Animation | Bot replies appear letter by letter like a real chat |
| 🌙 Dark / Light Mode | Toggle between themes with a single click |
| 🕐 Message Timestamps | Every message shows the time it was sent |
| 📋 Copy Button | Copy any bot reply to clipboard instantly |
| 🔊 Text-to-Speech | Listen to bot replies using browser Speech API |
| 🧠 Conversation Memory | Bot remembers the full session for context-aware replies |
| 🔒 Secure API | API key stored as environment variable, never in frontend code |
| ☁️ Serverless Backend | Vercel function handles all Grok API communication |
Frontend → HTML5, CSS3, Vanilla JavaScript
Backend → Vercel Serverless Functions (Node.js)
AI Model → Grok-3-mini (xAI) via REST API
Hosting → Vercel (Free Tier)
my-chatbot/
│
├── index.html # Main chat UI
├── style.css # Styling + dark mode
├── script.js # Frontend logic (typing, TTS, memory, copy)
│
└── api/
└── chat.js # Vercel serverless function → talks to Claude API
- A free account on console.x.ai to get your API key
- A free account on vercel.com
- Node.js installed on your machine
1. Clone this repository
git clone https://github.com/Gowtham10844/MANIT-Chat-Bot.git
cd MANIT-Chat-Bot2. Install Vercel CLI
npm install -g vercel3. Create a .env file in the root folder
XAI_API_KEY=your_api_key_here
⚠️ Never commit your.envfile. It is already added to.gitignore.
4. Run locally
vercel dev5. Open in browser
http://localhost:3000
1. Push your code to GitHub
git add .
git commit -m "Initial commit"
git push origin main2. Import project on Vercel
- Go to vercel.com → New Project → Import from GitHub
3. Add Environment Variable
- In Vercel project settings → Environment Variables
- Name:
XAI_API_KEY - Value: your key from console.x.ai
4. Click Deploy
- Vercel gives you a live URL instantly ✅
- Go to console.x.ai
- Sign in with your X (Twitter) account
- Click API Keys → Create API Key
- Copy and paste it into Vercel environment variables
- The Grok API key is never written in frontend code
- It is stored as a Vercel environment variable (server-side only)
- The
/api/chat.jsserverless function acts as a secure middleware between the user and Grok - No user data or chat history is stored anywhere — everything is session-only
| Light Mode | Dark Mode |
|---|---|
![]() |
![]() |
Saimpu Gowtham
- Roll No: 24112011269
- Branch: CSE
- College: MANIT, Bhopal
- GitHub: @Gowtham10844
Prof. Vasudev Dehalwar Department of Computer Science and Engineering Maulana Azad National Institute of Techonology, Bhopal
This project is licensed under the MIT License — feel free to use and modify it for educational purposes.
⭐ If you found this project helpful, consider giving it a star on GitHub!

