Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nicolasleiva/LatentGEO/llms.txt
Use this file to discover all available pages before exploring further.
System Architecture
LatentGEO is a production-ready, full-stack SaaS platform for SEO/GEO audits built with modern technologies and best practices.
Technology Stack
Backend
FastAPI + SQLAlchemy + Celery
Frontend
Next.js 16 (App Router)
Real-time
Server-Sent Events (SSE)
Infrastructure Components
| Component | Technology | Purpose |
|---|
| Database | Supabase Postgres | Primary data store with pooling |
| Cache & Queue | Redis | Real-time events, caching, Celery broker |
| Storage | Supabase Storage | File uploads and artifacts |
| Task Queue | Celery | Background job processing |
| Monitoring | Sentry | Error tracking and performance |
System Architecture Diagram
┌─────────────────────────────────────────────────────────────┐
│ CLIENT LAYER │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Next.js Frontend (Port 3000) │ │
│ │ • React 19 + App Router │ │
│ │ • TanStack Query (data fetching) │ │
│ │ • Radix UI + Tailwind CSS │ │
│ │ • SSE Client (useAuditSSE hook) │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
↕ HTTP/SSE
┌─────────────────────────────────────────────────────────────┐
│ API LAYER │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ FastAPI Backend (Port 8000) │ │
│ │ • API Versioning (/api/v1) │ │
│ │ • CORS & Auth Middleware │ │
│ │ • Rate Limiting (Redis-backed) │ │
│ │ • SSE Endpoints │ │
│ │ • OpenAPI Documentation │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
↕
┌─────────────────────────────────────────────────────────────┐
│ SERVICE LAYER │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Audit │ │ AI/LLM │ │ Content │ │
│ │ Service │ │ Service │ │ Service │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ SEO/GEO │ │ Analytics │ │ Backlinks │ │
│ │ Services │ │ Service │ │ Service │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
↕
┌─────────────────────────────────────────────────────────────┐
│ DATA LAYER │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Supabase │ │ Redis │ │ Supabase │ │
│ │ Postgres │ │ (Cache + │ │ Storage │ │
│ │ │ │ Queue) │ │ (Files) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
↕
┌─────────────────────────────────────────────────────────────┐
│ WORKER LAYER │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Celery Workers │ │
│ │ • Audit processing │ │
│ │ • SEO analysis │ │
│ │ • AI content generation │ │
│ │ • Report generation (PDF) │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Deployment Modes
LatentGEO supports two canonical Docker deployment modes:
1. Standard Mode (docker-compose.yml)
Production-ready configuration:
docker compose up --build -d
Characteristics:
- Backend/worker containers without code mounts
- Frontend in production mode (optimized build)
- Server-side API URL:
http://backend:8000
- Client-side API URL:
http://localhost:8000
- Suitable for staging and production environments
2. Development Mode (docker-compose.dev.yml)
Hot-reload development configuration:
docker compose -f docker-compose.dev.yml up --build
Characteristics:
- Hot reload for both backend and frontend
- Code mounted as volumes for instant updates
- Debug mode enabled
- Ideal for local development
Key Environment Variables
Backend Configuration
# SSE Real-time Configuration
SSE_SOURCE=redis # redis|db
SSE_FALLBACK_DB_INTERVAL_SECONDS=10 # Fallback polling interval
SSE_HEARTBEAT_SECONDS=30 # Keep-alive heartbeat
SSE_RETRY_MS=5000 # Client retry interval
# Database Configuration
DB_POOL_PRE_PING=false # Recommended for Supabase pooler
Frontend Configuration
# Server-side (internal Docker network)
API_URL=http://backend:8000
# Client-side (browser)
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
Service URLs
When running locally:
| Service | URL | Purpose |
|---|
| Frontend | http://localhost:3000 | User interface |
| Backend API | http://localhost:8000 | REST API |
| API Docs | http://localhost:8000/docs | Swagger UI |
| ReDoc | http://localhost:8000/redoc | Alternative API docs |
| OpenAPI JSON | http://localhost:8000/openapi.json | OpenAPI schema |
Real-time Communication
SSE vs Webhooks
LatentGEO uses both SSE and webhooks for different purposes:
- SSE (Server-Sent Events): Real-time progress updates for the UI dashboard
- Webhooks: External integrations (GitHub, HubSpot, etc.)
These are complementary, not exclusive:
- SSE solves real-time UX for audit progress
- Webhooks solve external automation and integrations
Security Features
Authentication
Auth0 integration with JWT bearer tokens
Rate Limiting
Redis-backed distributed rate limiting
CORS
Configurable CORS with credential support
Security Headers
CSP, HSTS, X-Frame-Options, etc.
Next Steps
Backend Details
Explore the FastAPI backend architecture
Frontend Details
Explore the Next.js frontend architecture
Real-time System
Deep dive into SSE implementation