← Back to projects

AI and SaaS

CiteGPT

CiteGPT focuses on giving businesses a support and lead-capture chatbot that stays grounded in their own site content.

AI SaaSRole: Founder & Full-Stack Product DeveloperDuration: July 2026 - PresentPublic project details
CiteGPT hero image

Project overview

A B2B SaaS platform combining sitemap crawling, HTML scraping, pgvector similarity searches, stateless JWT auth checks, and email infrastructure.

Who it is for
Businesses, startups, and service providers seeking to reduce customer-support questions and capture intent-driven leads.
Why it was created
Provide a reliable, factual customer assistant that cites source pages and prevents ungrounded chatbot hallucinations.

Technology stack

  • Next.js
  • TypeScript
  • RAG
  • Embeddable widget
  • Lead capture
  • pgvector

Problem

  • Visitor Drop-off: Website visitors leave when questions about services, pricing, or booking are not answered at the moment of intent.
  • Ungrounded AI Hallucinations: Generic chatbots lack factual boundaries and tend to invent pricing or policies, causing business liability.
  • Configuration Friction: Businesses need to ingest knowledge sources, test prompts, capture customer leads, and embed a lightweight widget without complex code integration.

Solution

  • Automatic Sitemap & URL Crawler: Crawls sitemaps and URLs, extracting clean article body text using specialized HTML parser readability engines.
  • pgvector similarity retrieval: Generates semantic text embeddings and compares queries against chunked knowledge sources in PostgreSQL.
  • Interactive Citation Tags: Attaches clickable references to source pages on every chatbot reply, allowing visitors to verify answers.
  • Embeddable Widget & Lead Form: Serves a lightweight chat widget with isolated visitor sessions, secure public tokens, and active lead capture workflows.

My role

  • Defined SaaS features, product scope, and database relations.
  • Built sitemap parser pipelines and pgvector search queries.
  • Designed and coded the dashboard interfaces, widget integration scripts, and Playground testing console.
  • Implemented custom JWT-based authentication cookies and transactional email integrations.

Key features

Website & Sitemap Ingestion

Crawl public websites and sitemaps, cleaning content using readability extractors.

RAG & pgvector Retrieval

Run semantic vector comparisons in PostgreSQL to supply grounded context.

Interactive Source Citations

Display clickable references linking directly to source pages on chatbot responses.

Stateless JWT Auth & Revocation

Secure dashboard routes via JWT cookies with instant global revocation.

Brevo Transactional Emails

Send user verification and password-reset messaging using transactional email APIs.

Resilient Lead Capture

Extract customer contact details and intents directly within the visitor chat flow.

Screenshots and visuals

CiteGPT dashboard cover illustration
desktop
Dashboard cover representation for CiteGPT.

Technical architecture

Frontend

  • • Next.js 16 App Router
  • • React 19 Server/Client Components
  • • Tailwind CSS
  • • Lucide Icons

Backend

  • • Next.js Route Handlers (API endpoints)
  • • Prisma Client ORM mapping layer

Database

  • • PostgreSQL (via Supabase / Neon)
  • • pgvector vector search extension
  • • Prisma Pg/Neon adapters

AI & External APIs

  • • OpenAI API (Embeddings & GPT-4o)
  • • Brevo transactional email API
  • • Stripe Billing

Challenges and solutions

Grounded Responses & Citations: Restricting the LLM to factual sitemap chunks without losing conversation flow.

Configured pgvector semantic cosine similarity checks (1 - (c.embedding <=> formattedEmbedding)) via raw SQL query fetches in Prisma. Attached retrieved chunk metadata directly to prompt scopes, forcing the model to generate source-aligned replies with clickable citation tags.

Database Infrastructure Portability: Migrating from Neon WebSockets to Supabase without rewriting database adapters or domain APIs.

Established a 'Replace Infrastructure, Do Not Rewrite Product Logic' architecture. Abstracted the database connection pool using a Proxy-backed Prisma client in db.ts. Swapping Neon (via serverless WebSockets adapter) for Supabase (via pg standard pool adapter) was achieved with environment variable changes, keeping product domain APIs completely untouched.

Playground & Analytics Isolation: Preventing admin prompt testing from corrupting real website conversion analytics and lead data.

Implemented an isPlayground schema flag on chat sessions and leads. Isolated playground calls from analytics queries, and added an automated 7-day retention cron endpoint (/api/cron/cleanup-playground) to purge historical test logs while leaving visitor histories intact.

Stateless Session Revocation: Ensuring JWT security cookies can be globally invalidated immediately upon password change.

Added a tokenVersion integer column to the User schema. During login, tokenVersion is signed into the JWT payload; during layout and API gates, it is compared against the database. Increments to tokenVersion during password resets revoke all other active sessions instantly.

Development process

  1. 01Positioning Analysis: Mapped support bottlenecks and B2B lead-capture requirements.
  2. 02Data Modeling: Configured relation boundaries for Organizations, Bots, Knowledge Sources, Content Chunks, Chat Sessions, and Contactable Leads.
  3. 03Crawler Implementation: Built background scraping workers leveraging HTML content cleanups.
  4. 04RAG & Security Integration: Setup raw pgvector query adapters, JWT session revocation, and Brevo transactional notifications.

Results

  • • Completed a fully functioning B2B SaaS chatbot builder with sitemap crawling and citation tracking.
  • • Designed a highly portable DB schema allowing zero-downtime Neon-to-Supabase migration.
  • • Built a secure, isolated playground workspace with automated cron session cleaning.

Lessons learned

  • • A B2B SaaS product succeeds based on operational controls—such as session security, rate limits, and analytics isolation—just as much as the core AI features.
  • • Decoupling the database client under an execution proxy simplifies cloud provider migrations and reduces technical debt.
  • • Showing interactive citation links improves conversion rates by transforming chat windows from standard text boxes into verified navigation maps.

Next steps

  • • Support PDF, DOCX, and CSV ingestion alongside HTML sitemaps.
  • • Add custom widget customization settings (avatar icons, CSS variables).

Need a similar product?

Let's talk about the next useful version of your product.

Discuss a Project