Skip to content

About

FAQ and knowledge base platform with multilingual semantic search (sentence-transformers) and LLM-based FAQ generation. FastAPI, PostgreSQL, React.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SynFAQ

SynFAQ is an intelligent B2B SaaS platform designed for creating, managing, and integrating smart Knowledge Bases and FAQ sections. Powered by advanced Machine Learning, semantic search, and Generative AI, SynFAQ ensures users find the right answers even when their search queries are vague, misspelled, or use colloquial language.


изображение

✨ Key Features & Interface

🛠️ 1. Administrative Workspace & Project Control

  • Multi-Project Account Dashboard: Manage multiple independent FAQ environments for different business units from a single, elegant workspace.
  • Granular Metrics Monitoring: Track active knowledge bases, global question counters, and creation dates seamlessly.
изображение
  • Flexible FAQ Onboarding: Choose between instant automated generation or manual initialization of an empty knowledge base structure.
  • AI-Powered Generation & File Ingestion: Instantly parse corporate descriptions or extract data from uploaded files (.txt, .pdf, .docx) using advanced LLMs via OpenRouter to build complex QA trees.
  • Dynamic Range Limits: Control token consumption and generation density by requesting between 5 and 20 targeted questions per session.

изображение   изображение

  • Complete CRUD Dashboard: Clean interactive layout to manually add questions, manage categories, append tag sets, or edit data fields before deployment.
  • Synonym Mapping: Explicitly map alternative search phrases to individual questions to fine-tune context-based retrieval probability.
изображение

👥 2. End-User Customer Experience

  • Intelligent Semantic Search: Context-aware search framework focusing on string intentions rather than static keyword evaluation.
  • Voice Search (MVP): Native audio interface integration enabling users to dictate search queries directly inside widgets.
  • Categorized Layout Routing: Fluid UI component filtering with responsive chips and clean accordion wrappers.
изображение

🛠 Tech Stack

  • Frontend: React, TypeScript, Vite, Tailwind CSS
  • Backend: Python, FastAPI, Pydantic (Strict configuration and data validation layer)
  • Database: PostgreSQL (Relational schema storage)
  • AI/ML Core: Local semantic retrieval powered by sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 (multilingual dense vector embeddings & similarity scoring), paired with OpenRouter Hub Orchestration (Gemma 4 26B / Llama 3.3) for automated FAQ tree generation. Features a highly resilient routing setup automatically cascading to backup clusters to prevent upstream HTTP 429 rate-limit exceptions.
  • Deployment: Docker Compose (PostgreSQL + FastAPI + Nginx serving the built frontend)

📂 Project Structure

InteractiveFAQ/
├── backend/            # FastAPI Application Source Code
│   ├── app/
│   │   ├── api/        # REST Route Controllers (Endpoints)
│   │   ├── core/       # Security: password hashing, JWT, API keys
│   │   ├── database/   # Database connection and session
│   │   ├── ml/         # Semantic search model
│   │   ├── models/     # SQLAlchemy Database Models
│   │   └── schemas/    # Pydantic Schemas (Request/Response Validation)
│   ├── seed.py         # Recreates the database and fills it with demo data
│   ├── requirements.txt
│   ├── Dockerfile
│   └── .env.example
├── frontend/           # React Client Application
│   ├── src/
│   ├── package.json
│   ├── nginx.conf
│   ├── Dockerfile
│   └── .env.example
├── docker-compose.yml
└── README.md

🚀 Installation & Quick Start

There are two ways to run the project. Docker is the easiest: one command starts the database, the backend and the frontend. The manual setup is more convenient if you are actively changing the code.

Option A. Docker (recommended)

Prerequisites: Git and Docker Desktop (running).

  1. Clone the repository:
git clone https://github.com/nleaxy/InteractiveFAQ.git
cd InteractiveFAQ
  1. Create backend/.env from the example:
# Windows (PowerShell):
copy backend\.env.example backend\.env
# macOS/Linux:
cp backend/.env.example backend/.env

Keep db as the host in DATABASE_URL, fill in JWT_SECRET and, if you need AI generation, OPENROUTER_API_KEY.

  1. Build and start all services:
docker compose up -d --build

The first build takes a while (Python and Node dependencies). On the first start the backend also downloads the search model (~0.5 GB), so the frontend starts only after the backend becomes healthy. You can follow the progress with docker compose logs -f backend.

  1. Fill the database with demo data (only once, see the warning below):
docker compose exec backend python seed.py
  1. Open http://localhost and log in with the demo account: admin@example.com / admin123.

Stopping and starting again:

docker compose stop    # stop, keeping containers, data and the downloaded model
docker compose start   # start again (about 1–2 minutes until the backend is ready)

docker compose down is also safe for your data, but removes the containers, so the search model will be downloaded again. Never use docker compose down -v: it deletes the database volume.

Option B. Manual setup

Prerequisites:

  • Python 3.10–3.12 (torch==2.3.1 does not support Python 3.13)
  • Node.js 18+ and npm
  • PostgreSQL

1. Database

Create a user and a database (for example in psql as the postgres user):

CREATE USER faq_user WITH PASSWORD 'faq_password';
CREATE DATABASE faq_db OWNER faq_user;

If you have Docker, you can start only the database instead: docker compose up -d db.

2. Backend

cd backend
python -m venv venv
# Windows:
.\venv\Scripts\Activate.ps1
# macOS/Linux:
source venv/bin/activate

pip install -r requirements.txt

On Windows, if the virtual environment cannot be activated, run once: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.

Create backend/.env from backend/.env.example and change the host in DATABASE_URL to localhost:

DATABASE_URL=postgresql://faq_user:faq_password@localhost:5432/faq_db
OPENROUTER_API_KEY=
JWT_SECRET=any_long_random_string

Fill the database with demo data and start the server:

python seed.py
uvicorn app.main:app --reload

On the first start the search model is downloaded. The server is ready when the log shows "ML модель успешно загружена". Interactive API docs: http://127.0.0.1:8000/docs.

3. Frontend

In a second terminal:

cd frontend
# Windows:
copy .env.example .env
# macOS/Linux:
cp .env.example .env

npm install
npm run dev

Open http://localhost:5173 and log in with admin@example.com / admin123.

⚠️ Notes

  • seed.py drops all tables and recreates them with demo data. Run it only once, otherwise all projects you created will be lost.
  • AI generation requires OPENROUTER_API_KEY (get one at openrouter.ai). Without it, everything else works: projects, manual FAQ editing and semantic search.
  • .env files are in .gitignore. Never commit your keys.

🔌 REST API & B2B Integration Hub

SynFAQ exposes a production-ready developer ecosystem allowing businesses to fetch external integrations and bridge their customer service widgets to the main semantic knowledge model. The full interactive reference is available at /docs on the backend.

изображение

Core Endpoint Map

1. Public API (for external integrations)

Authorized with the project's API key in the X-API-Key header.

  • GET /api/v1/faqs - Fetch all FAQ entries of the project.
  • POST /api/v1/faqs - Create a QA item with search synonyms.
  • PUT /api/v1/faqs/{faqId} - Modify an existing entry.
  • DELETE /api/v1/faqs/{faqId} - Delete an entry.
  • GET /api/v1/search?query=your_search_term&threshold=0.6 - Semantic search within the project.

2. AI FAQ Generation

  • POST /api/projects/v1/generate/?project_id={id} - Generate from a text description:
{
  "description": "Your business details or system specs...",
  "count": 7
}
  • POST /api/projects/v1/generate/file?project_id={id} - Generate from an uploaded .txt, .pdf or .docx file (multipart form: file, count).

Note: count must be an integer between 5 and 20.

3. Semantic Search (web app)

  • Endpoint: GET /api/projects/search?project_id={id}&query=your_search_term&threshold=0.6
  • Behavior: Evaluates the string against both the canonical question strings and the bound synonym array utilizing similarity score matrix rankings.
Снимок экрана 2026-06-25 010020

🗺 Roadmap

  • Enhance conversational tone adapters inside the AI generation layer.
  • Implement native bulk data imports (.json, existing FAQ pages).
  • Introduce real-time analytics dashboard to track user queries and search misses.
  • Full mobile responsive optimizations for the admin viewport.
  • Multi-tenant cloud workspace implementation.

👥 The Team

  • Team Lead / Backend Architect
  • Product Manager / Frontend Developer
  • Project Manager / Frontend Developer
  • DevOps & QA / Backend Developer
  • Business Analyst

📄 License

This repository was engineered explicitly for academic practice purposes. All rights reserved.

About

FAQ and knowledge base platform with multilingual semantic search (sentence-transformers) and LLM-based FAQ generation. FastAPI, PostgreSQL, React.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages