AI-powered FAQ search system using Cosdata OSS vector database - Built for Cosdata Hackathon 2025
Smart FAQ Assistant helps small businesses automate customer support by providing semantic search capabilities over their FAQ database. Instead of keyword matching, it uses vector similarity search powered by Cosdata OSS to understand the meaning of customer questions.
- π Easy FAQ Management - Add individual FAQs or bulk upload
- π Semantic Search - Search by meaning, not just keywords
- π¨ Modern UI - Clean, responsive React interface
- β‘ Fast Performance - Powered by Cosdata OSS vector search
- π Categorization - Organize FAQs by category (General, Technical, Billing, Product)
- π― Similarity Scores - See how well each result matches your query
Frontend:
- React 18
- Vite
- CSS3
Backend:
- Node.js
- Express.js
- Cosdata OSS (Vector Database)
- Node.js (v18 or higher)
- npm or yarn
- Docker Desktop (for running Cosdata)
- Windows PowerShell
Pull and Run Cosdata:
# Pull the image
docker pull cosdataio/cosdata:latest
# Run the container
docker run -d --name cosdata-server -p 8443:8443 -p 50051:50051 cosdataio/cosdata:latest
# Verify it's running
docker ps
# NOTE: This Cosdata image may not expose /health (it can return 404).
# Instead, create a session and then call an authenticated endpoint.
curl -sS -X POST http://localhost:8443/auth/create-session \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":""}'β
You should see a JSON response containing an access_token.
π Detailed setup: See COSDATA_SETUP.md
# Install backend dependencies
cd backend
npm install
# Frontend already has dependencies installedThe .env file is already created with default settings:
PORT=5050
COSDATA_API_URL=http://localhost:8443
If needed, you can also set Cosdata credentials (local Docker commonly uses an empty admin key):
COSDATA_USERNAME=admin
COSDATA_PASSWORD=
Optional: Add Hugging Face API key for better rate limits (free):
HUGGINGFACE_API_KEY=your_key_from_https://huggingface.co/settings/tokens
Terminal 1 - Backend:
cd backend
npm run dev
# Server runs on http://localhost:5050Terminal 2 - Frontend:
cd frontend
npm run dev
# App runs on http://localhost:5173- Open http://localhost:5173 in your browser
- Click "Load Sample FAQs" to add demo data (5 FAQs)
- Try semantic search:
- "How do I get my money back?" β Finds refund policy
- "Can't login" β Finds password reset
- "When are you open?" β Finds business hours
- Watch semantic search in action - it understands meaning, not just keywords!
smart-faq-assistant/
βββ backend/
β βββ routes/
β β βββ faqRoutes.js # FAQ CRUD endpoints
β β βββ searchRoutes.js # Search endpoint
β βββ services/
β β βββ cosdataService.js # Cosdata integration
β βββ server.js # Express server
β βββ package.json
β βββ .env
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ FAQUpload.jsx # FAQ upload form
β β β βββ SearchBox.jsx # Search interface
β β β βββ ResultsList.jsx # Search results
β β βββ App.jsx
β β βββ App.css
β βββ package.json
βββ README.md
GET /api/faq- Get all FAQsPOST /api/faq- Add single FAQPOST /api/faq/bulk- Bulk upload FAQsDELETE /api/faq/:id- Delete FAQ
POST /api/search- Semantic search{ "query": "How do I reset my password?", "topK": 5 }
- FAQ Upload: Questions and answers are converted to 384-dimensional vector embeddings using Hugging Face's
BAAI/bge-small-en-v1.5model (FREE!) - Vector Storage: Embeddings stored in Cosdata OSS vector database with metadata (answer, category, timestamp)
- Semantic Search: User queries are converted to vectors and matched using cosine similarity in Cosdata
- Ranked Results: Most relevant FAQs returned with similarity scores
Why It's Better Than Keyword Search:
- Understands "refund" = "money back" = "get my cash returned"
- Matches "can't sign in" with "reset password"
- No need for exact keyword matches!
This project uses 100% FREE embedding generation:
Hugging Face Inference API (No credit card required!)
- Model:
BAAI/bge-small-en-v1.5 - Dimensions: 384
- Rate Limit: ~1000 requests/hour without API key
- With free API key: Much higher limits
Get Your Free API Key (Optional but Recommended):
- Sign up at https://huggingface.co (free)
- Go to https://huggingface.co/settings/tokens
- Create a new token (Read access is enough)
- Add to
backend/.env:HUGGINGFACE_API_KEY=your_token_here
Edit backend/services/cosdataService.js:
// Change the model
this.embeddingModel = 'sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2'; // For multilingual support
// or
this.embeddingModel = 'BAAI/bge-small-en-v1.5'; // Higher quality, still free
// Update dimension if needed
this.dimension = 384; // or 768, 1024 depending on modelEdit frontend/src/components/FAQUpload.jsx:
<select id="category" ...>
<option value="general">General</option>
<option value="technical">Technical</option>
<option value="billing">Billing</option>
<option value="product">Product</option>
<option value="shipping">Shipping</option> {/* Add your category */}
</select>- β Integrate Cosdata OSS vector database
- β Use free Hugging Face embeddings
- β Semantic search functionality
- Add authentication for multi-business support
- Persist FAQs to PostgreSQL/MongoDB
- Add analytics dashboard (search trends, popular questions)
- Deploy to cloud (Vercel + Railway/Render)
- Add file upload for bulk FAQ import (CSV/JSON)
- Implement caching for faster searches
- Add multilingual support
Cosdata not running?
# Check if container is running
docker ps
# Check logs
docker logs cosdata-server
# Restart container
docker restart cosdata-serverBackend won't start?
- Check if port 5050 is available:
netstat -an | findstr 5050 - Ensure Cosdata is running:
curl http://localhost:8443/health - Check backend logs for errors
Search returns empty results?
- Make sure you've added FAQs first (click "Load Sample FAQs")
- Check backend console for embedding errors
- Verify Cosdata connection in backend logs
- Try restarting backend server
Hugging Face rate limit errors?
- Get a free API key from https://huggingface.co/settings/tokens
- Add to
backend/.env:HUGGINGFACE_API_KEY=your_token - Restart backend server
Frontend shows connection error?
- Ensure backend is running on port 5050
- Check browser console for CORS errors
- Verify
http://localhost:5050/healthreturns OK
- Reduce Support Tickets: Customers find answers instantly
- 24/7 Availability: No human agent needed
- Scalable: Handles thousands of FAQs efficiently
- Cost Savings: Reduce support team workload by 60-70%
MIT License - Built for Cosdata Hackathon 2025
- Cosdata for the amazing OSS vector database
- Vite for blazing fast development
- React for the UI framework
Built by [Your Name] for Cosdata Hackathon 2025
β Don't forget to star the Cosdata repo!