How danishashko/geo-aeo-tracker works
1. Overall shape
This is a Next.js 16 app-router repository for an AI visibility dashboard. The architecture is split into a browser-first UI, a set of server API routes, and a small server/client library layer that isolates persistence and vendor integrations.
2. User-facing shell
app/page.tsx renders the main dashboard, app/demo/page.tsx renders a standalone demo experience, and components/sovereign-dashboard.tsx acts as the primary shell that coordinates global app state, workspace selection, and tab navigation. The UI is organized into 13 feature tabs under components/dashboard/tabs.
3. Dashboard feature boundaries
Each tab maps to a distinct product function: project settings, prompt management, persona fan-out, niche discovery, response browsing, analytics, citations, citation opportunities, competitor battlecards, AEO audit, SRO analysis, automation, and documentation. This is a single-product dashboard with multiple specialized analytical workflows rather than a generic CRUD app.
4. Client-side data model and local-first storage
The client state model lives in components/dashboard/types.ts and is persisted through lib/client/sovereign-store.ts. The default storage path is IndexedDB, with localStorage used as a lightweight cache. This makes the app usable offline and keeps data on-device by default.
5. Optional cloud sync boundary
Cloud persistence is not direct-to-Supabase from the browser. When enabled, the client calls GET/PUT/DELETE /api/state, and the server route proxies to Supabase using a service-role key. The supabase/migrations/001_kv_store.sql migration creates the backing kv_store table. This keeps the Supabase credential entirely server-side and makes cloud sync an opt-in extension of the local store.
6. AI response collection pipeline
The main tracking workflow starts in the browser, then posts prompts to /api/scrape, which uses Bright Data AI Scraper datasets to query multiple AI providers. The README identifies six tracked models: ChatGPT, Perplexity, Gemini, Copilot, Google AI Overview, and Grok. The result is normalized response data used for visibility scoring and response browsing.
7. Analysis and synthesis routes
/api/analyze performs OpenRouter-backed LLM analysis and is the only route explicitly marked Edge runtime, which reduces latency for lighter inference tasks. /api/sro-analyze performs the final SRO synthesis step, combining collected evidence into scores and recommendations. /api/site-context provides homepage context extraction for analysis workflows, also backed by OpenRouter.
8. SRO pipeline as a multi-stage server workflow
The SRO feature is the most complex subsystem. It chains external data sources and internal synthesis: Gemini Grounding for search-based grounding, Bright Data SERP for search results, Bright Data Web Unlocker for page retrieval, site context extraction, and then a final LLM analysis step. Supporting code lives in lib/server/gemini-grounding.ts, serp.ts, unlocker.ts, brightdata-platforms.ts, and openrouter-sro.ts, with type definitions in sro-types.ts.
9. AEO audit and competitive intelligence
/api/audit checks site readiness signals such as llms.txt, schema, BLUF density, and heading structure. Separate routes and tabs support competitor-focused outputs like battlecards, citation opportunities, and platform citation polling. These features share a pattern: server-side collection, client-side comparison/visualization, and AI-generated summaries.
10. Runtime and deployment boundaries
The codebase distinguishes between Node and Edge execution where it matters: most scraping and storage routes run on Node, while /api/analyze is Edge for faster global inference. Deployment targets Vercel, and vercel.json plus proxy.ts indicate production routing/custom request handling. The app is designed to work in demo-only mode or full live mode via environment variables.
11. External services that define the architecture
Bright Data is the primary data acquisition layer for AI scrapers, SERP, and unlocker workflows. OpenRouter provides general LLM inference, Google Gemini powers grounding, and Supabase is only an optional persistence backend. These services are not interchangeable details; they define the app’s data flow and cost model.
12. Supporting tooling
scripts/test-scraper.js and scripts/test-pillar.js provide validation for data collection and feature behavior. lib/demo-data.ts supplies deterministic sample content for the demo path. Together with the README’s env-based setup, this shows a project built around reproducible local development with optional production integrations.
Main entry points: sovereign-dashboard.tsx Dashboard shell · route.ts SRO synth · openrouter-sro.ts SRO LLM · page.tsx Demo
Components 34
UI shell
Browser-first app entry points and dashboard coordination.
- Home · Main dashboard entry point.
app/page.tsx - Demo · Standalone demo experience.
app/demo/page.tsx - Dashboard shell · Coordinates workspace state, tab navigation, and app-level UX.
components/sovereign-dashboard.tsx - Dashboard types · Shared client-side state and domain types.
components/dashboard/types.ts
Dashboard features
Major analytical workflows exposed as tabs.
- Project settings · Workspace and configuration controls.
components/dashboard/tabs/project-settings-tab.tsx - Prompt hub · Prompt management and orchestration.
components/dashboard/tabs/prompt-hub-tab.tsx - Fan-out · Persona and response fan-out workflow.
components/dashboard/tabs/fan-out-tab.tsx - Analytics · Visibility scoring and trends.
components/dashboard/tabs/visibility-analytics-tab.tsx - AEO audit · Readiness checks for AI exposure.
components/dashboard/tabs/aeo-audit-tab.tsx - SRO analysis · Synthesis and recommendation workflow.
components/dashboard/tabs/sro-analysis-tab.tsx - Battlecards · Competitor comparison outputs.
components/dashboard/tabs/battlecards-tab.tsx - Citations · Citation opportunity discovery.
components/dashboard/tabs/citation-opportunities-tab.tsx - Automation · Scheduled and repeated workflows.
components/dashboard/tabs/automation-tab-v2.tsx - Docs · Product guidance and usage docs.
components/dashboard/tabs/documentation-tab.tsx
Server API
Route handlers for collection, analysis, and state sync.
- State API · Optional cloud sync for local state.
app/api/state/route.ts - Scrape API · Collects tracked model responses from external providers.
app/api/scrape/route.ts - Analyze API · Fast OpenRouter-backed analysis step.
app/api/analyze/route.ts - Site context · Extracts homepage context for analysis.
app/api/site-context/route.ts - SRO synth · Final synthesis for SRO scoring and recommendations.
app/api/sro-analyze/route.ts - Audit API · Checks schema, headings, BLUF, and llms.txt signals.
app/api/audit/route.ts - SERP API · Search results collection for grounding workflows.
app/api/serp/route.ts - Unlocker API · Retrieves web pages for evidence gathering.
app/api/unlocker/route.ts - Platforms API · Bright Data platform lookups and polling.
app/api/brightdata-platforms/route.ts
Server libs
Persistence, scraping, synthesis, and vendor integration code.
- KV store · Server-side backing store for optional synced state.
lib/server/kv-store.ts - Supabase · Optional cloud persistence backend.
lib/server/supabase.ts - Local store · IndexedDB-first local state with localStorage cache.
lib/client/sovereign-store.ts - Cloud mode · Client-side toggle and sync control for cloud persistence.
lib/client/cloud-mode.ts - Scraper · Bright Data AI Scraper dataset integration.
lib/server/brightdata-scraper.ts - Platforms · Bright Data platform utilities and shared config.
lib/server/brightdata-platforms.ts - Grounding · Gemini search-grounding workflow.
lib/server/gemini-grounding.ts - SRO LLM · OpenRouter-backed synthesis and analysis helpers.
lib/server/openrouter-sro.ts - SERP utils · Search result fetching and normalization helpers.
lib/server/serp.ts - Unlocker utils · Web unlock and page retrieval helpers.
lib/server/unlocker.ts - SRO types · Shared types for the SRO pipeline.
lib/server/sro-types.ts
Connections 32
- Home → Dashboard shell: renders · Main app mounts the dashboard shell.
- Demo → Dashboard shell: renders · Demo path reuses the same shell.
- Demo → Dashboard types: uses model · Demo experience is driven by the same domain state.
- Dashboard shell → Dashboard types: reads state · Shell coordinates workspace and tab state.
- Dashboard shell → Project settings: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Prompt hub: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Fan-out: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Analytics: navigates · Primary shell switches among feature tabs.
- Dashboard shell → AEO audit: navigates · Primary shell switches among feature tabs.
- Dashboard shell → SRO analysis: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Battlecards: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Citations: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Automation: navigates · Primary shell switches among feature tabs.
- Dashboard shell → Docs: navigates · Primary shell switches among feature tabs.
- Cloud mode → Local store: syncs · Cloud mode extends the local-first store.
- Cloud mode → State API: calls · Browser sync goes through the server route.
- State API → KV store: persists · Server route reads and writes stored state.
- KV store → Supabase: backs · Supabase is the optional persistence backend.
- Scrape API → Scraper: collects · Scrape route delegates external model collection.
- Scraper → Platforms: uses · Scraper depends on shared Bright Data platform utilities.
- Analyze API → SRO LLM: analyzes · Edge analysis uses OpenRouter helpers.
- Site context → SRO LLM: extracts · Context extraction is backed by the same LLM stack.
- SRO synth → Grounding: grounds · SRO synthesis starts with search grounding.
- SRO synth → SERP utils: queries · Search results are part of the evidence chain.
- SRO synth → Unlocker utils: retrieves · Page retrieval feeds the final synthesis.
- SRO synth → Site context: enriches · Context extraction is folded into the SRO pipeline.
- SRO synth → SRO LLM: synthesizes · Final scoring and recommendations are LLM-driven.
- SRO synth → SRO types: types · Shared pipeline contracts shape the workflow.
- Audit API → SRO LLM: summarizes · Audit output can be summarized with LLM support.
- SERP API → SERP utils: serves · API route exposes search collection helpers.
- Unlocker API → Unlocker utils: serves · API route exposes page retrieval helpers.
- Platforms API → Platforms: serves · API route exposes platform polling helpers.