Skip to content

AshishCherian15/study-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Study Bot — AI Study Assistant

Python FastAPI Frontend Backend Database

An AI-powered Study Assistant that answers academic questions and remembers conversation history by session.

🔗 Live Links

✨ Features

  • AI answers for study topics (Maths, Science, History, English, Programming)
  • Session-based chat memory with MongoDB Atlas
  • Modern chat UI with Local/Production mode switch
  • View previous history by session ID
  • Clear chat conversation instantly
  • FastAPI backend with Swagger docs

🧱 Architecture

  • Frontend: Static web app (frontend/) deployed on Vercel
  • Backend: FastAPI API (app.py) deployed on Render
  • LLM: Groq (LLaMA 3.3 70B)
  • Database: MongoDB Atlas

📁 Project Structure

study-bot/
├── app.py
├── requirements.txt
├── runtime.txt
├── gitignore
├── README.md
├── frontend/
│   ├── index.html
│   ├── styles.css
│   └── app.js
└── screenshots/
  └── image.png

⚙️ Local Setup

  1. Clone repo
git clone https://github.com/AshishCherian15/study-bot.git
cd study-bot
  1. Create and activate env
python -m venv venv
venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Create .env (or env) file
GROQ_API_KEY=your_groq_api_key
MONGO_URI=your_mongodb_connection_string
FRONTEND_ORIGINS=http://127.0.0.1:5500
  1. Start backend
uvicorn app:app --reload --host 127.0.0.1 --port 8000
  1. Open frontend
  • Open frontend/index.html via VS Code Live Server (e.g., 127.0.0.1:5500)
  • Keep Environment = Local in sidebar

🚀 Deployment

Vercel (Frontend)

  • Import repository in Vercel
  • Set Root Directory = frontend
  • Framework = Other
  • Deploy

Render (Backend)

  • Build command: pip install -r requirements.txt
  • Start command: uvicorn app:app --host 0.0.0.0 --port $PORT
  • Required env vars:
    • GROQ_API_KEY
    • MONGO_URI
    • FRONTEND_ORIGINS=https://study-bot-seven.vercel.app

📡 API Endpoints

  • GET / — Health check
  • POST /chat — Send message to Study Bot
  • GET /history/{session_id} — Get session history
  • DELETE /history/{session_id} — Clear session history

🧪 Example Request

{
  "session_id": "student123",
  "message": "Explain Newton's second law"
}

📸 Screenshots

  • Frontend UI

New UI

🔐 Security Notes

  • Never commit real API keys
  • Rotate keys immediately if leaked
  • Keep local secrets only in .env / env

📄 License

Educational and demonstration use.

About

AI-powered Study Assistant with session memory using FastAPI, Groq (LLaMA 3.3), and MongoDB Atlas.

Topics

Resources

Stars

Watchers

Forks

Contributors