Skip to content

Satish-Tiwari/InstantChatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Instant Chatbot β€” AI Website Assistant

A SaaS platform that transforms any website into a deployable AI-powered chatbot. Enter a URL, and the system crawls the website, builds a RAG knowledge base using Spring AI + PGVector, and generates a complete chatbot package ready for deployment.


✨ Features

  • Smart Web Crawling β€” Jsoup-powered crawler follows internal links + sitemap.xml
  • Content Processing β€” Cleans HTML, removes boilerplate, chunks text semantically
  • Automatic AI Failover β€” Self-healing RAG pipeline (OpenAI β†’ Anthropic β†’ Google)
  • User-Provided API Keys β€” Users can use their own OpenAI/Anthropic keys for project isolation
  • Switchable Engines β€” Toggle between AI providers instantly via UI or environment variables
  • Free Key Guide β€” Detailed guide on getting free API keys for all models
  • Code Generation β€” Auto-generates a FastAPI chatbot server + embeddable widget
  • ZIP Packaging β€” Download a ready-to-deploy chatbot with docs & deployment scripts
  • Modern Dashboard β€” Dark theme Next.js UI with real-time progress tracking
  • JWT Authentication β€” Secure user accounts with isolated project data
  • Chat Preview β€” Test your chatbot directly in the dashboard

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Next.js UI    β”‚          β”‚         Spring Boot Backend             β”‚
β”‚   (Port 3000)   │─── REST ─│                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                             β”‚  β”‚Crawler β”‚β†’β”‚Chunker  β”‚β†’β”‚Spring AI β”‚  β”‚
                             β”‚  β”‚(Jsoup) β”‚  β”‚         β”‚  β”‚Embed+RAG β”‚  β”‚
                             β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                             β”‚                              β”‚          β”‚
                             β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚          β”‚
                             β”‚  β”‚ Auth + Projects        β”‚   β”‚          β”‚
                             β”‚  β”‚ Code Gen + ZIP         β”‚   β”‚          β”‚
                             β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚          β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                             β”‚
                                                     β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                                                     β”‚ PostgreSQL   β”‚
                                                     β”‚ + PGVector   β”‚
                                                     β”‚  (Port 5432) β”‚
                                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key: Everything runs in a single JVM. No separate Python service, no ChromaDB β€” just Spring Boot + PostgreSQL.


πŸ› οΈ Tech Stack

Component Technology
Backend API Spring Boot 3.2, Java 17, Spring Security, JPA
AI / RAG Spring AI 1.0, OpenAI, Anthropic (Claude), Google (Gemini)
Vector Store PGVector (PostgreSQL extension via Spring AI)
Web Crawling Jsoup 1.17
Frontend Next.js 14, TypeScript, Tailwind CSS
State Mgmt Redux Toolkit (auth) + TanStack Query v5 (server state)
Forms React Hook Form + Zod schema validation
Database PostgreSQL 16 + PGVector
Auth JWT (jjwt 0.12) β€” separate secrets per service
Deployment Docker, Docker Compose

πŸ–ΌοΈ Platform Showcase

Dashboard New Project
Project Dashboard Multi-Model Configuration
Crawl Progress Chat Preview
Real-time Crawling Context-Aware Chat Preview

πŸš€ Quick Start (Development)

Follow these steps to run the complete project locally on your terminal.

1. Start the Database (PostgreSQL + PGVector)

Use Docker to run the database with the vector extension.

# This starts the database on port 5433 (to avoid conflicts with local Postgres)
docker compose up -d postgres

2. Start the Backend (Spring Boot AI)

Navigate to the backend folder and run with Maven.

cd backend
mvn spring-boot:run

Note: Ensure your backend/.env is configured with your OPENAI_API_KEY.

3. Start the Frontend (Next.js)

Navigate to the frontend folder and start the dev server.

cd frontend
npm run dev

The UI will be available at http://localhost:3000.


πŸ” Database Inspection

Use these commands to verify your data inside the running Docker container:

  • List Tables:
    docker exec -it instantchatbot-postgres psql -U postgres -d instantchatbot -c "\dt"
  • View Vector Data:
    docker exec -it instantchatbot-postgres psql -U postgres -d instantchatbot -c "SELECT * FROM vector_store LIMIT 5;"
  • Interactive Shell:
    docker exec -it instantchatbot-postgres psql -U postgres -d instantchatbot

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login, returns JWT
GET /api/auth/me Get current user

Projects

Method Endpoint Description
GET /api/projects List user's projects
POST /api/projects Create new project
GET /api/projects/{id} Get project details

Crawl & Chat

Method Endpoint Description
POST /api/projects/{id}/crawl Start crawling + RAG pipeline
GET /api/projects/{id}/status Get processing status
POST /api/projects/{id}/chat Send chat message (Spring AI RAG)
GET /api/projects/{id}/download Download chatbot ZIP

🧠 RAG Pipeline (Spring AI)

The entire AI pipeline runs inside the Spring Boot JVM:

URL Input β†’ WebCrawlerService (Jsoup)
         β†’ ContentCleanerService (HTML cleanup)
         β†’ TextChunkerService (semantic splitting)
         β†’ EmbeddingService (Spring AI β†’ OpenAI β†’ PGVector)
         β†’ RagService (Spring AI ChatClient β†’ OpenAI GPT-4o-mini)

Services in com.instantchatbot.service.ai:

Service Responsibility
WebCrawlerService Crawls website using Jsoup, follows links + sitemap
ContentCleanerService Strips boilerplate, extracts main content
TextChunkerService Splits text into semantic chunks with overlap
EmbeddingService Generates embeddings, stores in PGVector, searches
RagService Retrieves context + generates answers with multi-model failover
AiModelOrchestrator Manages global vs. user-provided AI models and keys
CrawlPipelineService Orchestrates the full async pipeline

πŸ“¦ Generated Chatbot Structure

When you download the ZIP, you get a standalone FastAPI chatbot:

chatbot-server/
β”œβ”€β”€ main.py              # FastAPI server with /chat endpoint
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ .env.example         # Configuration template
β”œβ”€β”€ Dockerfile           # Container deployment
β”œβ”€β”€ README.md            # Setup & deployment guide
β”œβ”€β”€ deploy.sh            # Auto-deployment script
└── widget/
    └── chatbot-widget.js  # Embeddable chat widget

πŸ”’ Security

  • Separate Secret Keys β€” Backend (JWT_SECRET) and frontend (NEXTAUTH_SECRET) each have independent secrets
  • JWT Authentication β€” Stateless token-based auth signed with the backend secret
  • Password Hashing β€” BCrypt encryption
  • Data Isolation β€” PGVector metadata filtering per project
  • Zod Validation β€” Client-side schema validation on all forms
  • URL Validation β€” Server-side input sanitization
  • CORS Configuration β€” Configurable allowed origins

πŸ“Š Project Status Flow

PENDING β†’ CRAWLING β†’ PROCESSING β†’ EMBEDDING β†’ READY
                                             β†˜ FAILED

πŸ“„ License

MIT License


Built with ❀️ using Spring Boot, Spring AI, PGVector, Next.js, and OpenAI

About

A SaaS platform that transforms any website into a deployable AI-powered chatbot. Enter a URL, and the system crawls the website, builds a RAG knowledge base using **Spring AI + PGVector**, and generates a complete chatbot package ready for deployment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors