💡 Inspiration
Search is going through its biggest shift in three decades. People no longer scroll through "10 blue links." They get a single synthesized answer from Google AI Overviews, Gemini, ChatGPT, and OpenRouter-hosted models.
If those engines don't cite your product, you effectively don't exist in generative search.
Traditional SEO tools like Ahrefs and Semrush can't see this layer. They track rankings, not how an LLM reasons about, summarizes, and attributes sources. We built Savoir to give businesses visibility into three things:
- AEO: Answer Engine Optimization
- GEO: Generative Engine Optimization
- AXO: Agent Experience Optimization
To make it a viable, self-sustaining SaaS rather than a technical demo, we used PayPal to power subscription tiers and automatic credit replenishment.
🚀 What It Does
Savoir audits, measures, and improves how AI agents perceive and cite your brand:
- Multi-engine brand monitoring. Runs large prompt sets across Gemini, OpenAI, OpenRouter, and Google AI Overviews, with live web grounding.
- Citation and sentiment intelligence. Tracks cited source domains, backlinks, and sentiment across generated answers.
- AXO technical audits. Uses Firecrawl to inspect
llms.txt,robots.txt, schema markup, and crawler accessibility, so you can see where AI agents hit friction. - PayPal-powered billing. Multi-tenant billing through PayPal Subscriptions and Smart Orders. Every monitoring query and deep crawl is metered against an atomic credit ledger.
📐 The Science: Quantifying Visibility
LLM outputs are non-deterministic, so one run tells you very little. Savoir scores visibility across repeated runs using a Generative Engine Visibility Index:
$$ V_{\text{GEO}} = \sum_{i=1}^{n} w_i \left( \alpha \, M_i + \beta \, \frac{C_{\text{brand},i}}{C_{\text{total},i} + \epsilon} + \gamma \, S_i \right) $$
where:
- $M_i \in {0,1}$ is whether the brand was explicitly mentioned in run $i$
- $C_{\text{brand},i}$ and $C_{\text{total},i}$ are brand citations and total grounded citations in run $i$
- $S_i \in [-1,1]$ is the sentiment of the mention
- $\alpha,\beta,\gamma \ge 0$ with $\alpha+\beta+\gamma=1$ are tunable weights
- $w_i$ is the authority weight of the engine used in run $i$
- $\epsilon > 0$ is a small constant that avoids division by zero
The index combines three signals: were you mentioned, were you cited, and how were you described.
🛠️ How We Built It
We designed Savoir as an enterprise B2B system, with resilience, tenant isolation, and payment idempotency as the main design goals.
┌────────────────────────────────────────────────────────┐
│ Next.js 16 + React 19 │
│ Turbopack • TailwindCSS • Real-time Charts │
└───────────────────────────┬────────────────────────────┘
│ REST / Secure JSON API
┌───────────────────────────▼────────────────────────────┐
│ Node.js + Express 5 + TypeScript │
│ Tenant Security • Strict Validation • CSRF Protection│
└─────────────┬───────────────────────────┬──────────────┘
│ │
┌─────────▼─────────┐ ┌─────────▼─────────┐
│ PostgreSQL 16 + │ │ BullMQ + Redis │
│ Drizzle ORM │ │ Distributed Queue │
│ Row-Level Security│ │ Spaced AI Workers │
└───────────────────┘ └─────────┬─────────┘
│
┌─────────────────┴─────────────────┐
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ PayPal Platform │ │ Multi-Engine AI │
│ Subscriptions & │ │ Gemini, OpenAI, │
│ Sandbox Webhooks │ │ OpenRouter, Firecrawl│
└─────────────────────┘ └─────────────────────┘
| Layer | Technology | Role |
|---|---|---|
| Frontend | Next.js 16, React 19, Tailwind CSS | Dashboard, citation explorer, charts |
| Backend | Node.js, Express 5, TypeScript | Validation, tenant isolation, owner-scoped authorization |
| Database | PostgreSQL 16, Drizzle ORM | Atomic transactions, row-level security, durable outbox |
| Queue | Redis 7, BullMQ | Task dispatch with bounded backoff and provider spacing |
| Payments | PayPal REST SDK and Subscriptions API (Sandbox) | Three plan tiers, Smart Checkout, verified webhooks |
| AI and crawling | Gemini, OpenAI, OpenRouter, Firecrawl | Prompt execution, source grounding, AXO audits |
PayPal integration
- Three tiers (Starter, Growth, Enterprise) built on the Subscriptions API.
- A webhook listener for
PAYMENT.SALE.COMPLETEDandBILLING.SUBSCRIPTION.ACTIVATED, with signature verification and replay protection. - A transactional database procedure,
savoir_apply_billing_event, that updates balances atomically so a credit is never applied twice.
⚡ Challenges We Ran Into
- Idempotency in payment webhooks. Network retries and webhook re-deliveries can corrupt credit balances. We built a deduplication pipeline in PostgreSQL keyed on unique event digests, so repeated deliveries never grant duplicate credits.
- Provider rate limits (HTTP 429). AI providers enforce per-minute and daily quotas. We decoupled user requests from LLM calls using a BullMQ persistent outbox, with configurable spacing (
MONITORING_CALL_SPACING_SECONDS) and bounded exponential backoff. - Multi-tenant security. In an analytics product, a cross-tenant leak is a showstopper. We enforced isolation at the database level with row-level security, and bound every query to the authenticated tenant and owner context.
- Normalizing heterogeneous models. Each engine returns citations in a different shape. We built a unified provider abstraction that maps them into one analytics schema.
🏆 Accomplishments We're Proud Of
- A working end-to-end system, not a mockup, with 200+ unit and integration tests passing.
- A unified provider abstraction that queries Gemini, ChatGPT, and OpenRouter models and standardizes their citations.
- A complete sandbox billing cycle: pick a plan, PayPal checkout opens, webhooks process asynchronously, and credits appear in the dashboard.
📚 What We Learned
- How to design event-driven payment flows that stay correct under retries, duplicates, and out-of-order webhooks.
- How generative engines cite some domains and omit others, and why that matters for brands.
- Why machine-readable standards like
llms.txtare likely to become as important assitemap.xml.
🔮 What's Next for Savoir
- Agentic commerce paywall. Let webmasters use PayPal to micro-bill AI crawler agents that request high-density structured data.
- Automated remediation. Generate content edits and schema patches aimed at raising citation probability in target engines.
- PayPal Vault auto-refill. One-click credit top-ups when balances fall below 10%.
Built With
- agentic-commerce
- artificial-intelligence
- bullmq
- chatgpt
- docker
- drizzle-orm
- express.js
- firecrawl
- google-gemini
- machine-learning
- next.js
- node.js
- openai
- openrouter
- paypal
- postgresql
- postman
- react
- redis
- render
- rest-api
- tailwindcss
- typescript
- webhooks