Skip to content

NelakaWith/faq-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– FAQ-Chatbot

Live Demo Deployment Status License: MIT Node.js Vue.js

Express.js Vite OpenRouter Fuse.js Conventional Commits

A modern AI-powered chatbot with intelligent knowledge base search and LLM integration, built with Vue 3 and Node.js.

πŸ”— Live Demo

Try the Live Demo | Video Demo

πŸ“‹ Overview

This project demonstrates a full-stack chatbot application with dual operational modes:

  • FAQ Mode: Intelligent search through structured knowledge bases with fuzzy matching
  • AI Assistant Mode: OpenRouter API integration with Google Gemma 3 for conversational AI

Built as a technical showcase demonstrating modern web development practices, component architecture, and AI integration patterns.

✨ Key Features

🧠 Intelligent Search System

  • Multi-layered Search: Exact match β†’ Keyword detection β†’ Fuzzy search β†’ PDF fallback
  • Semantic Understanding: Synonym handling and context-aware responses
  • PDF Processing: Automatic document parsing and content extraction

πŸ€– AI Integration

  • OpenRouter API: Integration with Google Gemma 3 model (free tier)
  • Conversation Management: Stateful chat with conversation history
  • Mode Switching: Seamless transition between FAQ and AI modes

🎨 Modern Frontend

  • Vue 3 Composition API: Component-based architecture with reactive state
  • Real-time UI: Typing indicators, loading states, and smooth animations
  • Responsive Design: Mobile-first approach with elegant chat interface

πŸ”§ Developer Experience

  • Hot Reload: Development servers with live updates
  • Error Handling: Comprehensive error boundaries and fallback responses
  • API Documentation: Well-documented RESTful endpoints

πŸ› οΈ Tech Stack

Frontend

  • Vue 3 - Progressive JavaScript framework with Composition API
  • Vite - Fast build tool and development server
  • Axios - HTTP client for API communication
  • CSS3 - Custom animations and responsive design

Backend

  • Node.js - JavaScript runtime environment
  • Express.js - Web application framework
  • Fuse.js - Powerful fuzzy search library
  • PDF-Parse - PDF text extraction utility

AI & APIs

  • OpenRouter API - LLM gateway service
  • Google Gemma 3 - Large language model (free tier)
  • REST Architecture - Clean API design patterns

DevOps & Tools

  • Git - Version control with conventional commits
  • npm workspaces - Monorepo dependency management
  • Environment Configuration - Secure API key management

πŸš€ Quick Start

Prerequisites

  • Node.js 16+ and npm
  • OpenRouter API key (free tier available)

Installation

  1. Clone the repository

    git clone https://github.com/NelakaWith/faq-chatbot.git
    cd faq-chatbot
  2. Install dependencies

    npm install
  3. Configure environment

    cd backend
    cp .env.example .env
    # Add your OPENROUTER_API_KEY to .env
  4. Start development servers

    Backend (Terminal 1):

    cd backend
    npm run dev

    Frontend (Terminal 2):

    cd frontend
    npm run dev
  5. Access the application

Windows Quick Start

# Run the included batch file
run-demo.bat

πŸ“š Project Structure

faq-chatbot/
β”œβ”€β”€ backend/              # Express.js API server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/   # Request handlers
β”‚   β”‚   β”œβ”€β”€ routes/        # API endpoints
β”‚   β”‚   β”œβ”€β”€ services/      # Business logic
β”‚   β”‚   └── utils/         # Helper functions
β”‚   β”œβ”€β”€ data/             # Knowledge base JSON files
β”‚   └── server.js         # Entry point
β”œβ”€β”€ frontend/             # Vue 3 SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Vue components
β”‚   β”‚   β”œβ”€β”€ composables/   # Reusable logic
β”‚   β”‚   └── styles/        # CSS modules
β”‚   └── vite.config.js
β”œβ”€β”€ documents/            # PDF knowledge base
β”œβ”€β”€ .github/workflows/    # CI/CD automation
└── README.md

πŸ§ͺ API Endpoints

Method Endpoint Description
POST /api/chat FAQ knowledge base search
POST /api/chat/llm OpenRouter AI conversation
GET /api/status Service status and metrics
GET /api/health Health check endpoint

πŸ“– Key Learnings

Technical Implementation

  • Vue 3 Composables: Learned reactive state management and composition patterns
  • API Integration: Implemented secure proxy patterns for external API consumption
  • Search Algorithms: Built multi-tier search with fallback strategies
  • Component Architecture: Designed reusable, maintainable component structures

Best Practices

  • Error Handling: Implemented comprehensive error boundaries and user feedback
  • State Management: Used reactive patterns for real-time UI updates
  • API Design: Created RESTful endpoints with proper status codes and responses
  • Security: Implemented environment-based configuration and API key protection

Problem Solving

  • Performance: Optimized search algorithms for large knowledge bases
  • User Experience: Added loading states, animations, and contextual feedback
  • Scalability: Designed modular architecture for easy feature expansion

🚧 Future Improvements

Short-term Enhancements

  • Vector Search: Implement semantic search with embeddings
  • User Authentication: Add login/logout and conversation persistence
  • Chat History: Save and restore previous conversations
  • File Upload: Allow users to upload documents for analysis

Advanced Features

  • Multi-model Support: Add support for GPT-4, Claude, and other LLMs
  • Voice Integration: Implement speech-to-text and text-to-speech
  • Admin Dashboard: Content management interface for knowledge base
  • Analytics: Usage tracking and conversation analytics

Technical Improvements

  • Testing Suite: Unit tests, integration tests, and E2E testing
  • Docker Deployment: Containerization for easy deployment
  • CDN Integration: Asset optimization and global distribution
  • Monitoring: Application performance monitoring and alerting

🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and development process.

πŸ‘¨β€πŸ’» Author

Nelaka Withanage

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Star this repository if you found it helpful!

Built with ❀️ using Express.js, Vue.js, and the OpenRouter API

About

A modern AI-powered chatbot with intelligent knowledge base search and LLM integration, built with Vue 3 and Node.js.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •