API and Architecture
Reference documentation for developers. The full content lives in the repo under docs/how-it-works/; open these files locally or on GitHub.
System overview
High-level architecture (Next.js app, API routes, Supabase, Stripe, external APIs), core concepts (notebooks, auth, audit pipeline).
docs/how-it-works/00-SYSTEM-OVERVIEW.md
API routes
All API routes grouped by domain: notebooks, auth, audit, billing, MCP gateway, visibility, prompts, integrations, and cron.
docs/how-it-works/01-API-ROUTES.md
Backend and audit
Map of src/lib/ modules: agents, orchestrator, visibility, integrations, billing.
docs/how-it-works/02-BACKEND-LIB.md
Audit state machine (PENDING → CRAWLING → SEO_FETCH → AEO_PROBES → SCORING → TASKS → COMPLETE), step flow, and resume behavior.
docs/how-it-works/03-AUDIT-PIPELINE.md
MCP and data flow
MCP server setup and tools for AI agents.
docs/how-it-works/04-MCP-INTEGRATION.md
Mock vs real data, Supabase tables, and how the dashboard reads data.
docs/how-it-works/05-DATA-FLOW.md
How to merge this system into another Next.js project or use it as reference.
docs/how-it-works/06-MERGE-GUIDE.md