# sp4chi/landing-iq architecture

> Architecture diagram of the GitHub repository sp4chi/landing-iq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sp4chi/landing-iq
- Repository: https://github.com/sp4chi/landing-iq

## Overview

LandingIQ audits landing pages and turns URL, pasted copy, description, or screenshot inputs into CRO recommendations, reports, and follow-up AI guidance. The principal flow runs from the dashboard through the analysis API and its visual, generative, and deterministic analysis layers to results and saved history. The README documents screenshot fallback, SEO/accessibility, copy optimization, and multiple AI providers; some implementation wiring is unsampled, so only documented or evidenced relationships are shown.

Main entry points: [`server/index.ts`](https://github.com/sp4chi/landing-iq/blob/main/server/index.ts) (Express API), [`src/App.tsx`](https://github.com/sp4chi/landing-iq/blob/main/src/App.tsx) (App shell), [`server/analyzer.ts`](https://github.com/sp4chi/landing-iq/blob/main/server/analyzer.ts) (Audit endpoint), [`src/db/index.ts`](https://github.com/sp4chi/landing-iq/blob/main/src/db/index.ts) (Database service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_dashboard["Audit inputs<br/>[DashboardPage.tsx]"]
  node_results["Audit results<br/>[ResultsPage.tsx]"]
  node_copilot["CRO Copilot<br/>[ChatCopilot.tsx]"]
  node_history["Report history<br/>[HistoryPage.tsx]"]
  node_account["Account settings<br/>[AccountPage.tsx]"]
  node_authpage["Sign-in UI<br/>[AuthPage.tsx]"]
end

subgraph group_server["API and analysis"]
  node_api["Express API<br/>[index.ts]"]
  node_analyzer["Audit endpoint<br/>[analyzer.ts]"]
  node_capture["Page capture<br/>[vision.ts]"]
  node_ml["Local NLP metrics<br/>[ml-analysis.ts]"]
  node_ai["AI provider layer<br/>[ai-provider.ts]"]
  node_chat["Chat endpoint<br/>[chat.ts]"]
end

subgraph group_state["Identity and reports"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_reports["Report endpoints<br/>[reports.ts]"]
  node_store[("Database service<br/>[index.ts]")]
end

subgraph group_integrations["External services"]
  node_target(("Audited webpage"))
  node_ai_services["AI providers"]
  node_postgres[("PostgreSQL")]
  node_capture_fallback["Screenshot fallback APIs"]
end

node_user(("LandingIQ user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_authpage
node_app -->|"renders"| node_results
node_app -->|"renders"| node_history
node_app -->|"renders"| node_account
node_dashboard -->|"submits audit"| node_api
node_api -->|"dispatches"| node_analyzer
node_analyzer -->|"requests capture"| node_capture
node_capture -->|"renders page"| node_target
node_capture -.->|"fetches screenshot"| node_capture_fallback
node_analyzer -->|"requests audit"| node_ai
node_analyzer -->|"computes metrics"| node_ml
node_ai -->|"sends prompts"| node_ai_services
node_analyzer -->|"saves report"| node_store
node_api -->|"dispatches"| node_auth
node_authpage -->|"authenticates"| node_auth
node_auth -->|"reads/writes users"| node_store
node_results -->|"offers chat"| node_copilot
node_copilot -->|"sends messages"| node_api
node_api -->|"dispatches"| node_chat
node_chat -->|"requests response"| node_ai
node_history -->|"loads reports"| node_api
node_account -->|"manages account"| node_api
node_api -->|"dispatches"| node_reports
node_reports -->|"reads/writes reports"| node_store
node_store -->|"queries"| node_postgres
node_analyzer -->|"returns audit"| node_results

click node_app "https://github.com/sp4chi/landing-iq/blob/main/src/App.tsx"
click node_dashboard "https://github.com/sp4chi/landing-iq/blob/main/src/pages/DashboardPage.tsx"
click node_results "https://github.com/sp4chi/landing-iq/blob/main/src/pages/ResultsPage.tsx"
click node_copilot "https://github.com/sp4chi/landing-iq/blob/main/src/components/ChatCopilot.tsx"
click node_history "https://github.com/sp4chi/landing-iq/blob/main/src/pages/HistoryPage.tsx"
click node_account "https://github.com/sp4chi/landing-iq/blob/main/src/pages/AccountPage.tsx"
click node_authpage "https://github.com/sp4chi/landing-iq/blob/main/src/pages/AuthPage.tsx"
click node_api "https://github.com/sp4chi/landing-iq/blob/main/server/index.ts"
click node_auth "https://github.com/sp4chi/landing-iq/blob/main/server/auth.ts"
click node_analyzer "https://github.com/sp4chi/landing-iq/blob/main/server/analyzer.ts"
click node_capture "https://github.com/sp4chi/landing-iq/blob/main/server/vision.ts"
click node_ml "https://github.com/sp4chi/landing-iq/blob/main/server/ml-analysis.ts"
click node_ai "https://github.com/sp4chi/landing-iq/blob/main/server/ai-provider.ts"
click node_chat "https://github.com/sp4chi/landing-iq/blob/main/server/chat.ts"
click node_reports "https://github.com/sp4chi/landing-iq/blob/main/server/reports.ts"
click node_store "https://github.com/sp4chi/landing-iq/blob/main/src/db/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_dashboard,node_results,node_copilot,node_history,node_account,node_authpage,node_user toneBlue
class node_api,node_analyzer,node_capture,node_ml,node_ai,node_chat toneAmber
class node_auth,node_reports,node_store toneMint
class node_target,node_ai_services,node_postgres,node_capture_fallback toneRose
```

## Components

### User experience

- [App shell](https://github.com/sp4chi/landing-iq/blob/main/src/App.tsx): `src/App.tsx`
- [Audit inputs](https://github.com/sp4chi/landing-iq/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Audit results](https://github.com/sp4chi/landing-iq/blob/main/src/pages/ResultsPage.tsx): `src/pages/ResultsPage.tsx`
- [CRO Copilot](https://github.com/sp4chi/landing-iq/blob/main/src/components/ChatCopilot.tsx): `src/components/ChatCopilot.tsx`
- [Report history](https://github.com/sp4chi/landing-iq/blob/main/src/pages/HistoryPage.tsx): `src/pages/HistoryPage.tsx`
- [Account settings](https://github.com/sp4chi/landing-iq/blob/main/src/pages/AccountPage.tsx): `src/pages/AccountPage.tsx`
- [Sign-in UI](https://github.com/sp4chi/landing-iq/blob/main/src/pages/AuthPage.tsx): `src/pages/AuthPage.tsx`

### API and analysis

- [Express API](https://github.com/sp4chi/landing-iq/blob/main/server/index.ts): `server/index.ts`
- [Audit endpoint](https://github.com/sp4chi/landing-iq/blob/main/server/analyzer.ts): `server/analyzer.ts`
- [Page capture](https://github.com/sp4chi/landing-iq/blob/main/server/vision.ts): `server/vision.ts`
- [Local NLP metrics](https://github.com/sp4chi/landing-iq/blob/main/server/ml-analysis.ts): `server/ml-analysis.ts`
- [AI provider layer](https://github.com/sp4chi/landing-iq/blob/main/server/ai-provider.ts): `server/ai-provider.ts`
- [Chat endpoint](https://github.com/sp4chi/landing-iq/blob/main/server/chat.ts): `server/chat.ts`

### Identity and reports

- [Authentication](https://github.com/sp4chi/landing-iq/blob/main/server/auth.ts): `server/auth.ts`
- [Report endpoints](https://github.com/sp4chi/landing-iq/blob/main/server/reports.ts): `server/reports.ts`
- [Database service](https://github.com/sp4chi/landing-iq/blob/main/src/db/index.ts): `src/db/index.ts`

### External services

- **Audited webpage**
- **AI providers**
- **PostgreSQL**
- **Screenshot fallback APIs**

### Other components

- **LandingIQ user**

## Connections

- LandingIQ user → App shell: uses
- App shell → Audit inputs: renders
- App shell → Sign-in UI: renders
- App shell → Audit results: renders
- App shell → Report history: renders
- App shell → Account settings: renders
- Audit inputs → Express API: submits audit
- Express API → Audit endpoint: dispatches
- Audit endpoint → Page capture: requests capture
- Page capture → Audited webpage: renders page
- Page capture → Screenshot fallback APIs: fetches screenshot
- Audit endpoint → AI provider layer: requests audit
- Audit endpoint → Local NLP metrics: computes metrics
- AI provider layer → AI providers: sends prompts
- Audit endpoint → Database service: saves report
- Express API → Authentication: dispatches
- Sign-in UI → Authentication: authenticates
- Authentication → Database service: reads/writes users
- Audit results → CRO Copilot: offers chat
- CRO Copilot → Express API: sends messages
- Express API → Chat endpoint: dispatches
- Chat endpoint → AI provider layer: requests response
- Report history → Express API: loads reports
- Account settings → Express API: manages account
- Express API → Report endpoints: dispatches
- Report endpoints → Database service: reads/writes reports
- Database service → PostgreSQL: queries
- Audit endpoint → Audit results: returns audit
