Build Intelligent Chatbots from PDFs
A comprehensive AI chatbot platform that transforms documents into intelligent conversational agents. Upload PDFs, create custom chatbots, and deploy them instantly.
- About ChatSmith
- Features
- Tech Stack
- Project Structure
- Getting Started
- Environment Setup
- Database Configuration
- ChatSmith Platform Screenshots
- Use Cases
- API Documentation
- Deployment
ChatSmith is an intelligent chatbot platform that allows you to create AI-powered chatbots from your PDF documents. Simply upload a PDF, and ChatSmith automatically:
- π Extracts text content from your documents
- π§ Processes and chunks the content intelligently
- π Embeds content using advanced AI models
- π¬ Creates a conversational AI chatbot
- π Deploys instantly for immediate use
- RAG (Retrieval Augmented Generation) - Accurate, context-aware responses
- Vector Search - Fast, semantic document retrieval
- Multi-Chatbot Management - Create unlimited chatbots
- Tone Customization - Adjust chatbot personality
- Real-time Chat - Instant responses with conversation history
- User & Admin Dashboards - Complete management interface
-
PDF Upload & Processing
- Automatic text extraction from PDFs
- Intelligent document chunking
- Vector embedding generation
- Metadata preservation
-
Chatbot Management
- Create multiple chatbots
- Edit chatbot details
- Delete chatbots and associated data
- View chatbot analytics
-
Advanced AI Chat
- Context-aware responses
- Conversation history tracking
- Tone adjustment (professional, casual, friendly, etc.)
- Real-time streaming responses
-
User Interface
- Modern, responsive design
- Dark mode support
- Intuitive chat interface
- Admin & user dashboards
- File upload with progress tracking
- Role-based access control (Admin/User)
- Secure API endpoints
- Data encryption
- Session management
- Next.js 16.0.0 - React framework with Turbopack
- React 19.2.0 - UI library
- TypeScript 5.0 - Type safety
- Tailwind CSS - Utility-first CSS
- Radix UI - Accessible component primitives
- Lucide Icons - Beautiful icon set
- Express 5.1.0 - Node.js web framework
- TypeScript - Type-safe backend
- LangChain 0.3.x - AI orchestration framework
- Cohere AI - Language models & embeddings
- Multer - File upload handling
- CORS - Cross-origin resource sharing
- Supabase - PostgreSQL database & authentication
- pgvector - Vector similarity search
- Supabase Vector Store - LangChain integration
- Cohere Embeddings - Document vectorization (embed-english-v3.0)
- Cohere Chat - Conversational AI
- LangChain - RAG implementation
- PDF Parse - Document processing
Hackthrone_gdc_techno/
βββ backend/ # Express.js backend server
β βββ api/
β β βββ chat.ts # Chat endpoint with RAG
β β βββ chatbots.ts # Chatbot CRUD operations
β β βββ upload.ts # PDF upload & processing
β β βββ tone.ts # Tone analysis
β βββ langchain/
β β βββ chains.ts # LangChain RAG chains
β β βββ embeddings.ts # Cohere embeddings
β β βββ loader.ts # Document loaders
β β βββ vectorStore.ts # Vector store setup
β βββ services/
β β βββ memory.ts # Conversation memory
β β βββ supabase.ts # Supabase client
β βββ uploads/ # Temporary PDF storage
β βββ main.ts # Server entry point
β βββ package.json
β
βββ main_frontend/ # Main Next.js application
β βββ app/
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β βββ components/
β β βββ admin-dashboard.tsx
β β βββ admin-header.tsx
β β βββ chat-interface.tsx # β
Integrated with backend
β β βββ chatbot-list.tsx # β
Integrated with backend
β β βββ chatbot-card.tsx
β β βββ dashboard.tsx
β β βββ login-page.tsx
β β βββ sidebar.tsx
β β βββ user-profile.tsx
β β βββ settings-page.tsx
β β βββ dark-toggle.tsx
β βββ lib/
β β βββ auth-context.tsx # Authentication context
β β βββ utils.ts # Utility functions
β βββ package.json
β
βββ frontend/ # Alternative frontend (legacy)
β βββ app/
β βββ components/
β βββ lib/
β
βββ .env # Environment variables (create this)
βββ SETUP_GUIDE.md # Detailed setup instructions
βββ BACKEND_INTEGRATION_SETUP.md
βββ README.md # This file
- Node.js 16.x or higher
- npm or yarn package manager
- Supabase account (free tier available)
- Cohere API account (free trial with credits)
-
Clone the repository
git clone <repository-url> cd Hackthrone_gdc_techno
-
Install dependencies
Backend:
cd backend npm installFrontend:
cd main_frontend npm install -
Set up environment variables
Create
backend/.env:# Supabase Configuration SUPABASE_URL=your_supabase_project_url SUPABASE_ANON_KEY=your_supabase_anon_key # Cohere API Key COHERE_API_KEY=your_cohere_api_key # Server Port PORT=8000
-
Set up Supabase Database
See Database Configuration section below.
-
Start the servers
Backend (in one terminal):
cd backend npm run devFrontend (in another terminal):
cd main_frontend npm run dev -
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
Create a backend/.env file with:
| Variable | Description | Required | Example |
|---|---|---|---|
SUPABASE_URL |
Supabase project URL | β Yes | https://xxx.supabase.co |
SUPABASE_ANON_KEY |
Supabase anonymous key | β Yes | eyJhbGciOiJIUzI1NiIs... |
COHERE_API_KEY |
Cohere API key | β Yes | your_api_key_here |
PORT |
Backend server port | β No | 8000 (default) |
Create a main_frontend/.env.local file (optional):
| Variable | Description | Required | Example |
|---|---|---|---|
NEXT_PUBLIC_BACKEND_API_URL |
Backend API URL | β No | http://localhost:8000 |
Note: The frontend automatically falls back to http://localhost:8000 if not set.
- Go to supabase.com
- Create a new project (free tier available)
- Navigate to Settings β API
- Copy:
- Project URL β
SUPABASE_URL - anon/public key β
SUPABASE_ANON_KEY
- Project URL β
- Go to cohere.ai
- Sign up (free trial with credits)
- Navigate to API Keys
- Copy your API key β
COHERE_API_KEY
-
Enable pgvector extension
In Supabase SQL Editor:
CREATE EXTENSION IF NOT EXISTS vector;
-
Create chatbots table
CREATE TABLE chatbots ( id UUID PRIMARY KEY, name TEXT NOT NULL, description TEXT, pdf_name TEXT, created_at TIMESTAMP DEFAULT NOW(), message_count INTEGER DEFAULT 0 );
-
Create documents table (vector embeddings)
CREATE TABLE documents ( id BIGSERIAL PRIMARY KEY, content TEXT, metadata JSONB, embedding VECTOR(1024), chatbot_id UUID REFERENCES chatbots(id) ON DELETE CASCADE ); -- Create index for faster similarity search CREATE INDEX ON documents USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
-
Create chat_messages table
CREATE TABLE chat_messages ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), chatbot_id UUID REFERENCES chatbots(id) ON DELETE CASCADE, role TEXT NOT NULL, content TEXT NOT NULL, created_at TIMESTAMP DEFAULT NOW() );
-
Create vector search function
CREATE OR REPLACE FUNCTION match_documents( query_embedding VECTOR(1024), match_chatbot_id UUID, match_count INT DEFAULT 5 ) RETURNS TABLE ( id BIGINT, content TEXT, metadata JSONB, similarity FLOAT ) LANGUAGE plpgsql AS $$ BEGIN RETURN QUERY SELECT documents.id, documents.content, documents.metadata, 1 - (documents.embedding <=> query_embedding) AS similarity FROM documents WHERE documents.chatbot_id = match_chatbot_id ORDER BY documents.embedding <=> query_embedding LIMIT match_count; END; $$;
For detailed setup instructions, see SETUP_GUIDE.md.
ChatSmith can be used to build various AI-powered applications:
An integrated healthcare platform built using ChatSmith's chatbot technology.
Features:
- Patient portal with AI health assistant
- Doctor dashboard with clinical decision support
- Guardian access for family health monitoring
- Pharmacy integration with prescription chatbots
- Health records Q&A
- Medication adherence tracking with AI reminders
Tech Stack:
- React + Vite + TypeScript
- MongoDB for patient data
- ChatSmith chatbots for health consultations
- Real-time notifications
Learn More: See the VitaData section at the end of this README.
- Upload product manuals and documentation
- Instant customer support responses
- 24/7 availability
- Upload textbooks and study materials
- Interactive learning experience
- Question answering system
- Upload legal documents and contracts
- Quick document search
- Legal Q&A
- Company policies and procedures
- Employee handbook chatbot
- Onboarding assistant
http://localhost:8000
POST /upload
Content-Type: multipart/form-data
Body:
- file: PDF file
- name: Chatbot name
Response:
{
"message": "PDF processed and chatbot created",
"chatbotId": "uuid",
"name": "Chatbot Name",
"createdAt": "ISO timestamp"
}GET /chatbots
Response:
[
{
"id": "uuid",
"name": "Chatbot Name",
"description": "Description",
"pdf_name": "document.pdf",
"created_at": "timestamp",
"message_count": 0
}
]DELETE /chatbots/:chatbotId
Response:
{
"message": "Chatbot and all related data deleted."
}POST /chat
Content-Type: application/json
Body:
{
"chatbotId": "uuid",
"message": "Your question here",
"history": [
{ "role": "user", "content": "Previous question" },
{ "role": "ai", "content": "Previous answer" }
],
"tone": "professional" // optional
}
Response:
{
"id": "message-id",
"content": "AI response here",
"sources": [...] // optional
}POST /tone
Content-Type: application/json
Body:
{
"text": "Text to analyze"
}
Response:
{
"tone": "professional",
"confidence": 0.95
}# Development server with hot reload
npm run dev
# Build TypeScript
npm run build
# Start production server
npm start
# Type checking
npm run lint# Development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Linting
npm run lint- Push code to GitHub
- Connect repository to Railway/Render
- Add environment variables in dashboard
- Deploy automatically
- Push code to GitHub
- Import project in Vercel
- Set environment variables
- Deploy automatically
Make sure to set all required environment variables in your deployment platform:
SUPABASE_URLSUPABASE_ANON_KEYCOHERE_API_KEYNEXT_PUBLIC_BACKEND_API_URL(frontend only)
- PDF upload and processing
- Vector embeddings with Cohere
- Chatbot CRUD operations
- RAG-based chat with context
- Conversation history
- Tone customization
- Supabase vector store integration
- Chatbot list with real data
- Create chatbot with PDF upload
- Delete chatbot functionality
- Chat interface with backend
- Loading states and error handling
- Responsive design
- Dark mode support
- User authentication (mock)
- Admin dashboard
Backend fails to start
- Check if
.envfile exists inbackend/folder - Verify all required environment variables are set
- Ensure Supabase URL and key are correct
Frontend can't connect to backend
- Ensure backend is running on port 8000
- Check CORS settings in backend
- Verify API URL in frontend
Chatbot creation fails
- Check Cohere API key is valid
- Ensure Supabase tables are created
- Check PDF file size (should be < 10MB)
- Verify pgvector extension is enabled
Vector search not working
- Run the
match_documentsfunction creation SQL - Ensure embeddings dimension is 1024
- Check index creation on documents table
For detailed troubleshooting, see SETUP_GUIDE.md.
- Never commit
.envfiles - Add to.gitignore - Use environment variables - For all sensitive data
- Validate file uploads - Check file types and sizes
- Sanitize user inputs - Prevent injection attacks
- Use HTTPS in production - Secure all connections
- Implement rate limiting - Prevent abuse
- Regular security audits - Keep dependencies updated
- Real-time streaming responses
- Multi-language support
- Voice input/output
- Advanced analytics dashboard
- Chatbot sharing and embedding
- Custom branding options
- Webhook integrations
- API key management
- Usage metrics and billing
- Team collaboration features
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions, issues, or support:
- Create an issue in the repository
- Contact the development team
- Check documentation files
VitaData is a comprehensive healthcare platform built using ChatSmith's AI chatbot technology as its core conversational engine.
VitaData demonstrates ChatSmith's versatility by implementing:
- AI-powered health consultations
- Medical document Q&A
- Medication reminders and tracking
- Multi-stakeholder platform (patients, doctors, guardians, pharmacies)
- Frontend: React 18.2 + Vite + TypeScript
- Backend: MongoDB Atlas + Firebase/Supabase
- AI Engine: ChatSmith chatbot platform
- Styling: Tailwind CSS + Framer Motion
- Patient Portal - Health dashboard, appointments, prescriptions
- Doctor Dashboard - Patient management, clinical workflows
- Guardian Portal - Family health monitoring
- Pharmacy Hub - Prescription processing, delivery
- Health consultation chatbots
- Medication adherence AI assistant
- Symptom checker
- Medical document Q&A
- Prescription interpretation
- Digital health records
- Vitals tracking (BP, blood sugar, temperature)
- Lab reports management
- Appointment scheduling
- Prescription management
VitaData Application
βββ Patient/Doctor/Guardian/Pharmacy Portals
βββ MongoDB (Patient data, appointments, prescriptions)
βββ ChatSmith Integration
β βββ Medical knowledge chatbots
β βββ Prescription Q&A bots
β βββ Health guidance assistants
β βββ Medication tracking bots
βββ Real-time Notifications & Reminders
- Set up ChatSmith platform (this repository)
- Create medical knowledge chatbots:
- Upload medical guidelines PDFs
- Upload medication information
- Upload hospital procedures
- Configure VitaData frontend to use ChatSmith API
- Set up MongoDB for patient data
- Deploy both applications
β
24/7 Health Assistance - AI chatbots always available
β
Reduced Wait Times - Instant answers to common questions
β
Better Patient Engagement - Interactive health management
β
Knowledge Accessibility - Complex medical info simplified
β
Scalable Solution - Serve unlimited patients simultaneously
Comprehensive patient health management interface
Clinical workflow and patient management system
Family health monitoring and care coordination
Prescription processing and delivery management
Advanced healthcare platform capabilities
Built with β€οΈ by the ChatSmith Team
ChatSmith - Transforming Documents into Intelligent Conversations
Documentation β’ API Docs β’ Use Cases






