Skip to content

Repository files navigation

Answerly ✳️, RAG Support Chatbot SaaS

Live: https://answerly-liard.vercel.app · Demo login: demo@answerly.app / Demo123! · Widget demo: https://answerly-liard.vercel.app/demo

Train an AI support agent on your docs and embed it on any website with one script tag. Grounded answers, real citations, polite refusals for anything off-topic.

Features

  • Knowledge ingestion: upload PDF/TXT/MD files, paste text, or fetch a URL; content is transcribed to markdown (Gemini handles PDFs natively), chunked along headings, and embedded with gemini-embedding-001 into Supabase pgvector
  • Grounded answers with citations: cosine similarity search (match_chunks SQL function, HNSW index) feeds only retrieved context to the model; every answer cites its sources, and zero-match queries short-circuit to the fallback message without an LLM call
  • Embeddable widget: <script src=".../embed.js" data-bot-id="..."> drops a branded chat bubble on any site; /demo is a fake customer site running it live
  • Dashboard: per-bot knowledge manager with live indexing status, test chat, conversation transcripts (answered/fallback pills + citations), 30-day analytics (conversations chart, answer-rate donut, latency)
  • Widget hardening: unguessable bot ids, per-visitor (15/min) and per-bot (120/h) rate limits, optional origin allowlist, message length caps, SSRF-guarded URL fetching

Stack

Next.js 14 (App Router) · TypeScript · Tailwind · Supabase (Postgres + pgvector + Storage) · Gemini 2.5 Flash + gemini-embedding-001 · NextAuth v5 · Recharts

Architecture notes

  • Embeddings are requested at 768 dimensions and L2-normalized in code (output at this dimensionality is not pre-normalized) so cosine distance is correct
  • Chunks carry a sourceTitle > heading prefix, which is what makes citations accurate
  • Ingestion runs synchronously in the API route (sized to fit Vercel's 60s hobby limit); the dashboard polls source status, no queue infrastructure

Run locally

npm install
cp .env.example .env.local   # fill in Supabase + Gemini keys
node scripts/run-sql.mjs     # creates schema incl. pgvector (needs SUPABASE_DB_PASSWORD)
node scripts/seed-demo.mjs   # seeds the CloudCanvas demo bot with real embeddings
npm run dev

Environment

Var Purpose
NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase project + publishable key
SUPABASE_SECRET_KEY server-only key for private Storage
GOOGLE_GEMINI_API_KEY generation + embeddings
AUTH_SECRET / NEXTAUTH_SECRET NextAuth
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET optional Google OAuth

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages